summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_error_codes/src/error_codes/E0460.md
blob: 001678a9bce0625f359d3553c316bcf4fbdd67ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Found possibly newer version of crate `..` which `..` depends on.

Consider these erroneous files:

`a1.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "a"]

pub fn foo<T>() {}
```

`a2.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "a"]

pub fn foo<T>() {
    println!("foo<T>()");
}
```

`b.rs`
```ignore (needs-linkage-with-other-tests)
#![crate_name = "b"]

extern crate a; // linked with `a1.rs`

pub fn foo() {
    a::foo::<isize>();
}
```

`main.rs`
```ignore (needs-linkage-with-other-tests)
extern crate a; // linked with `a2.rs`
extern crate b; // error: found possibly newer version of crate `a` which `b`
                //        depends on

fn main() {}
```

The dependency graph of this program can be represented as follows:
```text
    crate `main`
         |
         +-------------+
         |             |
         |             v
depends: |         crate `b`
 `a` v1  |             |
         |             | depends:
         |             |  `a` v2
         v             |
      crate `a` <------+
```

Crate `main` depends on crate `a` (version 1) and crate `b` which in turn
depends on crate `a` (version 2); this discrepancy in versions cannot be
reconciled. This difference in versions typically occurs when one crate is
compiled and linked, then updated and linked to another crate. The crate
"version" is a SVH (Strict Version Hash) of the crate in an
implementation-specific way. Note that this error can *only* occur when
directly compiling and linking with `rustc`; [Cargo] automatically resolves
dependencies, without using the compiler's own dependency management that
causes this issue.

This error can be fixed by:
 * Using [Cargo], the Rust package manager, automatically fixing this issue.
 * Recompiling crate `a` so that both crate `b` and `main` have a uniform
   version to depend on.

[Cargo]: ../cargo/index.html