mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Auto merge of #116228 - bvanjoi:fix-116164, r=cjgillot
resolve: skip underscore character during candidate lookup Fixes #116164 In use statement, an underscore is merely a placeholder symbol and does not bind to any name. Therefore, it can be safely ignored.
This commit is contained in:
commit
16b7b39fdd
@ -1169,6 +1169,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
|
||||
return;
|
||||
}
|
||||
|
||||
if ident.name == kw::Underscore {
|
||||
return;
|
||||
}
|
||||
|
||||
let child_accessible =
|
||||
accessible && this.is_accessible_from(name_binding.vis, parent_scope.module);
|
||||
|
||||
|
19
tests/ui/resolve/issue-116164.rs
Normal file
19
tests/ui/resolve/issue-116164.rs
Normal 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
|
||||
}
|
14
tests/ui/resolve/issue-116164.stderr
Normal file
14
tests/ui/resolve/issue-116164.stderr
Normal 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`.
|
Loading…
Reference in New Issue
Block a user