diff options
| author | Michael <michael.prantl@hotmail.de> | 2021-11-26 21:39:44 +0000 |
|---|---|---|
| committer | Michael <michael.prantl@hotmail.de> | 2021-12-01 21:59:54 +0000 |
| commit | 2ca933301183b1e913802bc5710c0cb5218ada28 (patch) | |
| tree | d8245bcf8b925372623abc3f1606a1aaede029a1 /src | |
| parent | 62f4ce993e8aa788c8269d75aea2db84cafb1f9f (diff) | |
Improve suggestion for extern crate self error message
Diffstat (limited to 'src')
7 files changed, 41 insertions, 6 deletions
diff --git a/src/test/ui/crate-loading/invalid-rlib.rs b/src/test/ui/crate-loading/invalid-rlib.rs index 77c29090a3e..aea861e3261 100644 --- a/src/test/ui/crate-loading/invalid-rlib.rs +++ b/src/test/ui/crate-loading/invalid-rlib.rs @@ -6,3 +6,5 @@ #![no_std] use ::foo; //~ ERROR invalid metadata files for crate `foo` //~| NOTE failed to mmap file +//~^^ ERROR invalid metadata files for crate `foo` +//~| NOTE failed to mmap file diff --git a/src/test/ui/crate-loading/invalid-rlib.stderr b/src/test/ui/crate-loading/invalid-rlib.stderr index b2c79f742fb..3c0d23bf7b4 100644 --- a/src/test/ui/crate-loading/invalid-rlib.stderr +++ b/src/test/ui/crate-loading/invalid-rlib.stderr @@ -6,6 +6,14 @@ LL | use ::foo; | = note: failed to mmap file 'auxiliary/libfoo.rlib' -error: aborting due to previous error +error[E0786]: found invalid metadata files for crate `foo` + --> $DIR/invalid-rlib.rs:7:7 + | +LL | use ::foo; + | ^^^ + | + = note: failed to mmap file 'auxiliary/libfoo.rlib' + +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0786`. diff --git a/src/test/ui/extern-flag/empty-extern-arg.rs b/src/test/ui/extern-flag/empty-extern-arg.rs index d3cb5aaaeba..3170537b0e0 100644 --- a/src/test/ui/extern-flag/empty-extern-arg.rs +++ b/src/test/ui/extern-flag/empty-extern-arg.rs @@ -1,4 +1,6 @@ // compile-flags: --extern std= // error-pattern: extern location for std does not exist +// needs-unwind since it affects the error output +// ignore-emscripten compiled with panic=abort, personality not required fn main() {} diff --git a/src/test/ui/extern/extern-crate-multiple-missing.rs b/src/test/ui/extern/extern-crate-multiple-missing.rs index fa7da83a6df..a6560ca7862 100644 --- a/src/test/ui/extern/extern-crate-multiple-missing.rs +++ b/src/test/ui/extern/extern-crate-multiple-missing.rs @@ -3,6 +3,8 @@ extern crate bar; //~ ERROR can't find crate for `bar` extern crate foo; //~ ERROR can't find crate for `foo` fn main() { + // If the crate name introduced by `extern crate` failed to resolve then subsequent + // derived paths do not emit additional errors foo::something(); bar::something(); } diff --git a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr index 8f369f1b038..127765727b4 100644 --- a/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr +++ b/src/test/ui/imports/extern-crate-self/extern-crate-self-fail.stderr @@ -2,7 +2,12 @@ error: `extern crate self;` requires renaming --> $DIR/extern-crate-self-fail.rs:1:1 | LL | extern crate self; - | ^^^^^^^^^^^^^^^^^^ help: try: `extern crate self as name;` + | ^^^^^^^^^^^^^^^^^^ + | +help: rename the `self` crate to be able to import it + | +LL | extern crate self as name; + | ~~~~~~~~~~~~~~~~~~~~~~~~~~ error: `#[macro_use]` is not supported on `extern crate self` --> $DIR/extern-crate-self-fail.rs:3:1 diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.rs b/src/test/ui/rust-2018/uniform-paths/deadlock.rs index 83ed70a0459..2427bde6d18 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.rs +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.rs @@ -1,7 +1,8 @@ // edition:2018 // compile-flags:--extern foo --extern bar +use bar::foo; //~ ERROR can't find crate for `bar` use foo::bar; //~ ERROR can't find crate for `foo` -use bar::foo; +//~^^ ERROR unresolved imports `bar::foo`, `foo::bar` fn main() {} diff --git a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr index 9336e90afb7..8b9863948bd 100644 --- a/src/test/ui/rust-2018/uniform-paths/deadlock.stderr +++ b/src/test/ui/rust-2018/uniform-paths/deadlock.stderr @@ -1,9 +1,24 @@ -error[E0463]: can't find crate for `foo` +error[E0463]: can't find crate for `bar` --> $DIR/deadlock.rs:4:5 | +LL | use bar::foo; + | ^^^ can't find crate + +error[E0463]: can't find crate for `foo` + --> $DIR/deadlock.rs:5:5 + | LL | use foo::bar; | ^^^ can't find crate -error: aborting due to previous error +error[E0432]: unresolved imports `bar::foo`, `foo::bar` + --> $DIR/deadlock.rs:4:5 + | +LL | use bar::foo; + | ^^^^^^^^ +LL | use foo::bar; + | ^^^^^^^^ + +error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0463`. +Some errors have detailed explanations: E0432, E0463. +For more information about an error, try `rustc --explain E0432`. |
