Improve suggestion for extern crate self error message
This commit is contained in:
parent
62f4ce993e
commit
2ca9333011
12 changed files with 77 additions and 70 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
| ^^^^^^^^
|
||||
|
||||
For more information about this error, try `rustc --explain E0463`.
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0432, E0463.
|
||||
For more information about an error, try `rustc --explain E0432`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue