Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resolve: skip underscore character during candidate lookup #116228

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions compiler/rustc_resolve/src/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
19 changes: 19 additions & 0 deletions tests/ui/resolve/issue-116164.rs
Original file line number Diff line number Diff line change
@@ -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 changes: 14 additions & 0 deletions tests/ui/resolve/issue-116164.stderr
Original file line number Diff line number Diff line change
@@ -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