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.
This commit is contained in:
parent
2e56b6f98e
commit
cc6a09009d
11 changed files with 57 additions and 3 deletions
|
@ -237,6 +237,7 @@ E0455: include_str!("./error_codes/E0455.md"),
|
|||
E0458: include_str!("./error_codes/E0458.md"),
|
||||
E0459: include_str!("./error_codes/E0459.md"),
|
||||
E0463: include_str!("./error_codes/E0463.md"),
|
||||
E0464: include_str!("./error_codes/E0464.md"),
|
||||
E0466: include_str!("./error_codes/E0466.md"),
|
||||
E0468: include_str!("./error_codes/E0468.md"),
|
||||
E0469: include_str!("./error_codes/E0469.md"),
|
||||
|
@ -587,7 +588,6 @@ E0785: include_str!("./error_codes/E0785.md"),
|
|||
E0460, // found possibly newer version of crate `..`
|
||||
E0461, // couldn't find crate `..` with expected target triple ..
|
||||
E0462, // found staticlib `..` instead of rlib or dylib
|
||||
E0464, // multiple matching crates for `..`
|
||||
E0465, // multiple .. candidates for `..` found
|
||||
// E0467, removed
|
||||
// E0470, removed
|
||||
|
|
6
compiler/rustc_error_codes/src/error_codes/E0464.md
Normal file
6
compiler/rustc_error_codes/src/error_codes/E0464.md
Normal file
|
@ -0,0 +1,6 @@
|
|||
The compiler found multiple library files with the requested crate name.
|
||||
|
||||
This error can occur in several different cases -- for example, when using
|
||||
`extern crate` or passing `--extern` options without crate paths. It can also be
|
||||
caused by caching issues with the build directory, in which case `cargo clean`
|
||||
may help.
|
|
@ -6,6 +6,8 @@
|
|||
// normalize-stderr-test: "\\\?\\" -> ""
|
||||
// normalize-stderr-test: "libcrateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$1.somelib"
|
||||
|
||||
// NOTE: This test is duplicated at `src/test/ui/error-codes/E0464.rs`.
|
||||
|
||||
extern crate crateresolve1;
|
||||
//~^ ERROR multiple matching crates for `crateresolve1`
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
error[E0464]: multiple matching crates for `crateresolve1`
|
||||
--> $DIR/crateresolve1.rs:9:1
|
||||
--> $DIR/crateresolve1.rs:11:1
|
||||
|
|
||||
LL | extern crate crateresolve1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -11,3 +11,4 @@ LL | extern crate crateresolve1;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0464`.
|
||||
|
|
|
@ -11,3 +11,4 @@ LL | extern crate crateresolve2;
|
|||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0464`.
|
||||
|
|
15
src/test/ui/error-codes/E0464.rs
Normal file
15
src/test/ui/error-codes/E0464.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
// aux-build:crateresolve1-1.rs
|
||||
// aux-build:crateresolve1-2.rs
|
||||
// aux-build:crateresolve1-3.rs
|
||||
|
||||
// normalize-stderr-test: "\.nll/" -> "/"
|
||||
// normalize-stderr-test: "\\\?\\" -> ""
|
||||
// normalize-stderr-test: "libcrateresolve1-([123])\.[a-z]+" -> "libcrateresolve1-$1.somelib"
|
||||
|
||||
// NOTE: This test is duplicated from `src/test/ui/crate-loading/crateresolve1.rs`.
|
||||
|
||||
extern crate crateresolve1;
|
||||
//~^ ERROR multiple matching crates for `crateresolve1`
|
||||
|
||||
fn main() {
|
||||
}
|
14
src/test/ui/error-codes/E0464.stderr
Normal file
14
src/test/ui/error-codes/E0464.stderr
Normal file
|
@ -0,0 +1,14 @@
|
|||
error[E0464]: multiple matching crates for `crateresolve1`
|
||||
--> $DIR/E0464.rs:11:1
|
||||
|
|
||||
LL | extern crate crateresolve1;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: candidates:
|
||||
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-1.somelib
|
||||
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-2.somelib
|
||||
crate `crateresolve1`: $TEST_BUILD_DIR/error-codes/E0464/auxiliary/libcrateresolve1-3.somelib
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0464`.
|
5
src/test/ui/error-codes/auxiliary/crateresolve1-1.rs
Normal file
5
src/test/ui/error-codes/auxiliary/crateresolve1-1.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// compile-flags:-C extra-filename=-1
|
||||
#![crate_name = "crateresolve1"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn f() -> isize { 10 }
|
5
src/test/ui/error-codes/auxiliary/crateresolve1-2.rs
Normal file
5
src/test/ui/error-codes/auxiliary/crateresolve1-2.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// compile-flags:-C extra-filename=-2
|
||||
#![crate_name = "crateresolve1"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn f() -> isize { 20 }
|
5
src/test/ui/error-codes/auxiliary/crateresolve1-3.rs
Normal file
5
src/test/ui/error-codes/auxiliary/crateresolve1-3.rs
Normal file
|
@ -0,0 +1,5 @@
|
|||
// compile-flags:-C extra-filename=-3
|
||||
#![crate_name = "crateresolve1"]
|
||||
#![crate_type = "lib"]
|
||||
|
||||
pub fn f() -> isize { 30 }
|
|
@ -15,7 +15,7 @@ const EXEMPTED_FROM_TEST: &[&str] = &[
|
|||
];
|
||||
|
||||
// Some error codes don't have any tests apparently...
|
||||
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0570", "E0601", "E0602", "E0729"];
|
||||
const IGNORE_EXPLANATION_CHECK: &[&str] = &["E0464", "E0570", "E0601", "E0602", "E0729"];
|
||||
|
||||
// If the file path contains any of these, we don't want to try to extract error codes from it.
|
||||
//
|
||||
|
|
Loading…
Add table
Reference in a new issue