]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0460.md
Merge from rustc
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0460.md
1 Found possibly newer version of crate `..` which `..` depends on.
2
3 Consider these erroneous files:
4
5 `a1.rs`
6 ```ignore (needs-linkage-with-other-tests)
7 #![crate_name = "a"]
8
9 pub fn foo<T>() {}
10 ```
11
12 `a2.rs`
13 ```ignore (needs-linkage-with-other-tests)
14 #![crate_name = "a"]
15
16 pub fn foo<T>() {
17     println!("foo<T>()");
18 }
19 ```
20
21 `b.rs`
22 ```ignore (needs-linkage-with-other-tests)
23 #![crate_name = "b"]
24
25 extern crate a; // linked with `a1.rs`
26
27 pub fn foo() {
28     a::foo::<isize>();
29 }
30 ```
31
32 `main.rs`
33 ```ignore (needs-linkage-with-other-tests)
34 extern crate a; // linked with `a2.rs`
35 extern crate b; // error: found possibly newer version of crate `a` which `b`
36                 //        depends on
37
38 fn main() {}
39 ```
40
41 The dependency graph of this program can be represented as follows:
42 ```text
43     crate `main`
44          |
45          +-------------+
46          |             |
47          |             v
48 depends: |         crate `b`
49  `a` v1  |             |
50          |             | depends:
51          |             |  `a` v2
52          v             |
53       crate `a` <------+
54 ```
55
56 Crate `main` depends on crate `a` (version 1) and crate `b` which in turn
57 depends on crate `a` (version 2); this discrepancy in versions cannot be
58 reconciled. This difference in versions typically occurs when one crate is
59 compiled and linked, then updated and linked to another crate. The crate
60 "version" is a SVH (Strict Version Hash) of the crate in an
61 implementation-specific way. Note that this error can *only* occur when
62 directly compiling and linking with `rustc`; [Cargo] automatically resolves
63 dependencies, without using the compiler's own dependency management that
64 causes this issue.
65
66 This error can be fixed by:
67  * Using [Cargo], the Rust package manager, automatically fixing this issue.
68  * Recompiling crate `a` so that both crate `b` and `main` have a uniform
69    version to depend on.
70
71 [Cargo]: ../cargo/index.html