resolve: Recover "did you mean" suggestions in imports

This commit is contained in:
Vadim Petrochenkov 2018-11-11 17:35:23 +03:00
parent 4c5d822a8b
commit cfe81559ee
5 changed files with 36 additions and 50 deletions

View file

@ -23,11 +23,11 @@ mod a {
mod c {
use alloc::HashMap;
//~^ ERROR unresolved import `alloc` [E0432]
//~| Did you mean `std::alloc`?
//~| Did you mean `a::alloc`?
mod d {
use alloc::HashMap;
//~^ ERROR unresolved import `alloc` [E0432]
//~| Did you mean `std::alloc`?
//~| Did you mean `a::alloc`?
}
}
}

View file

@ -14,13 +14,13 @@ error[E0432]: unresolved import `alloc`
--> $DIR/resolve_self_super_hint.rs:24:17
|
LL | use alloc::HashMap;
| ^^^^^ Did you mean `std::alloc`?
| ^^^^^ Did you mean `a::alloc`?
error[E0432]: unresolved import `alloc`
--> $DIR/resolve_self_super_hint.rs:28:21
|
LL | use alloc::HashMap;
| ^^^^^ Did you mean `std::alloc`?
| ^^^^^ Did you mean `a::alloc`?
error: aborting due to 4 previous errors

View file

@ -16,7 +16,7 @@ mod foo {
pub type Bar = u32;
}
mod baz {
mod bazz {
use foo::Bar;
fn baz() {

View file

@ -6,18 +6,12 @@ LL | use foo::Bar;
|
= note: `use` statements changed in Rust 2018; read more at <https://doc.rust-lang.org/edition-guide/rust-2018/module-system/path-clarity.html>
error[E0432]: unresolved import `foo`
--> $DIR/local-path-suggestions-2018.rs:27:5
|
LL | use foo::Bar;
| ^^^ Did you mean `self::foo`?
error[E0432]: unresolved import `foobar`
--> $DIR/local-path-suggestions-2018.rs:29:5
|
LL | use foobar::Baz;
| ^^^^^^ Did you mean `baz::foobar`?
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0432`.