resolve: skip underscore character during candidate lookup

This commit is contained in:
bohan 2023-09-28 19:47:58 +08:00
parent 46da927abb
commit cfb819fa7e
3 changed files with 37 additions and 0 deletions

View file

@ -1169,6 +1169,10 @@ fn lookup_import_candidates_from_module<FilterFn>(
return;
}
if ident.name == kw::Underscore {
return;
}
let child_accessible =
accessible && this.is_accessible_from(name_binding.vis, parent_scope.module);

View file

@ -0,0 +1,19 @@
#![allow(unused_imports)]
mod inner {
pub enum Example {
ExOne,
}
}
mod reexports {
pub use crate::inner::Example as _;
}
use crate::reexports::*;
//~^ SUGGESTION: use inner::Example::ExOne
fn main() {
ExOne;
//~^ ERROR: cannot find value `ExOne` in this scope
}

View file

@ -0,0 +1,14 @@
error[E0425]: cannot find value `ExOne` in this scope
--> $DIR/issue-116164.rs:17:5
|
LL | ExOne;
| ^^^^^ not found in this scope
|
help: consider importing this unit variant
|
LL + use inner::Example::ExOne;
|
error: aborting due to previous error
For more information about this error, try `rustc --explain E0425`.