Skip to content

Commit 8aa417c

Browse files
committed
Add long explanation for E0464
The test is copied from `src/test/ui/crate-loading/crateresolve1.rs` and its auxiliary tests. I added it to the `compile_fail` code example check exemption list since it's hard if not impossible to reproduce this error in a standalone code example.
1 parent 79b3ef8 commit 8aa417c

File tree

10 files changed

+51
-2
lines changed

10 files changed

+51
-2
lines changed

compiler/rustc_error_codes/src/error_codes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ E0455: include_str!("./error_codes/E0455.md"),
237237
E0458: include_str!("./error_codes/E0458.md"),
238238
E0459: include_str!("./error_codes/E0459.md"),
239239
E0463: include_str!("./error_codes/E0463.md"),
240+
E0464: include_str!("./error_codes/E0464.md"),
240241
E0466: include_str!("./error_codes/E0466.md"),
241242
E0468: include_str!("./error_codes/E0468.md"),
242243
E0469: include_str!("./error_codes/E0469.md"),
@@ -586,7 +587,6 @@ E0785: include_str!("./error_codes/E0785.md"),
586587
E0460, // found possibly newer version of crate `..`
587588
E0461, // couldn't find crate `..` with expected target triple ..
588589
E0462, // found staticlib `..` instead of rlib or dylib
589-
E0464, // multiple matching crates for `..`
590590
E0465, // multiple .. candidates for `..` found
591591
// E0467, removed
592592
// E0470, removed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
The compiler found multiple library files with the requested crate name.
2+
3+
This error can occur in several different cases -- for example, when using
4+
`extern crate` or passing `--extern` options without crate paths. It can also be
5+
caused by caching issues with the build directory, in which case `cargo clean`
6+
may help.

src/test/ui/crate-loading/crateresolve1.stderr

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

1212
error: aborting due to previous error
1313

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

src/test/ui/crate-loading/crateresolve2.stderr

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

1212
error: aborting due to previous error
1313

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

src/test/ui/error-codes/E0464.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// aux-build:crateresolve1-1.rs
2+
// aux-build:crateresolve1-2.rs
3+
// aux-build:crateresolve1-3.rs
4+
5+
// normalize-stderr-test: "\.so" -> ".dylib"
6+
// normalize-stderr-test: "\.dll" -> ".dylib"
7+
8+
extern crate crateresolve1;
9+
//~^ ERROR multiple matching crates for `crateresolve1`
10+
11+
fn main() {
12+
}

src/test/ui/error-codes/E0464.stderr

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
error[E0464]: multiple matching crates for `crateresolve1`
2+
--> $DIR/E0464.rs:8:1
3+
|
4+
LL | extern crate crateresolve1;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: candidates:
8+
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-1.dylib
9+
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-2.dylib
10+
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-3.dylib
11+
12+
error: aborting due to previous error
13+
14+
For more information about this error, try `rustc --explain E0464`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// compile-flags:-C extra-filename=-1
2+
#![crate_name = "crateresolve1"]
3+
#![crate_type = "lib"]
4+
5+
pub fn f() -> isize { 10 }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// compile-flags:-C extra-filename=-2
2+
#![crate_name = "crateresolve1"]
3+
#![crate_type = "lib"]
4+
5+
pub fn f() -> isize { 20 }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// compile-flags:-C extra-filename=-3
2+
#![crate_name = "crateresolve1"]
3+
#![crate_type = "lib"]
4+
5+
pub fn f() -> isize { 30 }

src/tools/tidy/src/error_codes_check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const EXEMPTED_FROM_TEST: &[&str] = &[
1515
];
1616

1717
// Some error codes don't have any tests apparently...
18-
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0570", "E0601", "E0602", "E0729"];
18+
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0464", "E0570", "E0601", "E0602", "E0729"];
1919

2020
// If the file path contains any of these, we don't want to try to extract error codes from it.
2121
//

0 commit comments

Comments
 (0)