Skip to content

Commit 7e66d45

Browse files
committed
docs: add long-form error-code docs for E0460
1 parent ff016a5 commit 7e66d45

10 files changed

+80
-1
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ E0454: include_str!("./error_codes/E0454.md"),
241241
E0455: include_str!("./error_codes/E0455.md"),
242242
E0458: include_str!("./error_codes/E0458.md"),
243243
E0459: include_str!("./error_codes/E0459.md"),
244+
E0460: include_str!("./error_codes/E0460.md"),
244245
E0463: include_str!("./error_codes/E0463.md"),
245246
E0464: include_str!("./error_codes/E0464.md"),
246247
E0466: include_str!("./error_codes/E0466.md"),
@@ -593,7 +594,6 @@ E0791: include_str!("./error_codes/E0791.md"),
593594
// E0427, // merged into 530
594595
// E0456, // plugin `..` is not available for triple `..`
595596
E0457, // plugin `..` only found in rlib format, but must be available...
596-
E0460, // found possibly newer version of crate `..`
597597
E0461, // couldn't find crate `..` with expected target triple ..
598598
E0462, // found staticlib `..` instead of rlib or dylib
599599
E0465, // multiple .. candidates for `..` found
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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

src/test/ui/svh/changing-crates.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-lit.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-significant-cfg.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-trait-bound.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-type-arg.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-type-ret.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-change-type-static.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate b;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

src/test/ui/svh/svh-use-trait.stderr

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ LL | extern crate utb;
1111

1212
error: aborting due to previous error
1313

14+
For more information about this error, try `rustc --explain E0460`.

0 commit comments

Comments
 (0)