Add re-exports to use suggestions
In the following example, an inaccessible path is suggested via
`use foo::bar::X;` whereas an accessible public exported path can
be suggested instead.
```
mod foo {
mod bar {
pub struct X;
}
pub use self::bar::X;
}
fn main() { X; }
```
This fixes the issue.
This commit is contained in:
parent
3b1c08c68c
commit
404df1cbbf
7 changed files with 42 additions and 17 deletions
|
|
@ -29,3 +29,7 @@ fn main() {
|
|||
foo::<C>(); //~ ERROR: cannot find type `C` in this scope
|
||||
foo::<D>(); //~ ERROR: cannot find type `D` in this scope
|
||||
}
|
||||
|
||||
mod other {
|
||||
pub fn import() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,11 @@ error[E0425]: cannot find function `import` in this scope
|
|||
|
|
||||
LL | import();
|
||||
| ^^^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing this function
|
||||
|
|
||||
LL | use other::import;
|
||||
|
|
||||
|
||||
error[E0412]: cannot find type `A` in this scope
|
||||
--> $DIR/glob-resolve1.rs:28:11
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ help: consider importing one of these items instead
|
|||
|
|
||||
LL | use m2::S;
|
||||
|
|
||||
LL | use namespace_mix::xm2::S;
|
||||
LL | use xm2::S;
|
||||
|
|
||||
|
||||
error[E0423]: expected value, found type alias `xm1::S`
|
||||
|
|
@ -39,7 +39,7 @@ help: consider importing one of these items instead
|
|||
|
|
||||
LL | use m2::S;
|
||||
|
|
||||
LL | use namespace_mix::xm2::S;
|
||||
LL | use xm2::S;
|
||||
|
|
||||
|
||||
error[E0423]: expected value, found struct variant `m7::V`
|
||||
|
|
@ -61,7 +61,7 @@ help: consider importing one of these items instead
|
|||
|
|
||||
LL | use m8::V;
|
||||
|
|
||||
LL | use namespace_mix::xm8::V;
|
||||
LL | use xm8::V;
|
||||
|
|
||||
|
||||
error[E0423]: expected value, found struct variant `xm7::V`
|
||||
|
|
@ -83,7 +83,7 @@ help: consider importing one of these items instead
|
|||
|
|
||||
LL | use m8::V;
|
||||
|
|
||||
LL | use namespace_mix::xm8::V;
|
||||
LL | use xm8::V;
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `c::Item: Impossible` is not satisfied
|
||||
|
|
|
|||
|
|
@ -4,7 +4,9 @@ error[E0405]: cannot find trait `T` in this scope
|
|||
LL | impl T for Foo { }
|
||||
| ^ not found in this scope
|
||||
|
|
||||
help: consider importing this trait
|
||||
help: consider importing one of these items
|
||||
|
|
||||
LL | use baz::T;
|
||||
|
|
||||
LL | use foo::bar::T;
|
||||
|
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ LL | let _: E = m::n::Z;
|
|||
| ^
|
||||
help: consider importing this enum
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
LL | use m::Z;
|
||||
|
|
||||
|
||||
error[E0423]: expected value, found enum `m::n::Z`
|
||||
|
|
@ -165,7 +165,7 @@ LL | let _: E = m::n::Z::Fn;
|
|||
| ^
|
||||
help: consider importing this enum
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
LL | use m::Z;
|
||||
|
|
||||
|
||||
error[E0412]: cannot find type `Z` in this scope
|
||||
|
|
@ -183,7 +183,7 @@ LL | let _: E = m::n::Z::Struct;
|
|||
| ^
|
||||
help: consider importing this enum
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
LL | use m::Z;
|
||||
|
|
||||
|
||||
error[E0423]: expected value, found struct variant `m::n::Z::Struct`
|
||||
|
|
@ -212,7 +212,7 @@ LL | let _: E = m::n::Z::Unit {};
|
|||
| ^
|
||||
help: consider importing this enum
|
||||
|
|
||||
LL | use m::n::Z;
|
||||
LL | use m::Z;
|
||||
|
|
||||
|
||||
error[E0603]: enum `Z` is private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue