about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-01 16:41:03 +0000
committerbors <bors@rust-lang.org>2023-10-01 16:41:03 +0000
commit16b7b39fdddff00c237c71e237881f835b43cad6 (patch)
tree354f0469bf7b35b3a8c2e7527c9f301fd59395fc /compiler/rustc_resolve/src
parent6c29b45439a9523e2f2cdf99e40cd5443db9677d (diff)
parentcfb819fa7e7dd16e756eca6d19ac78c7635436bd (diff)
downloadrust-16b7b39fdddff00c237c71e237881f835b43cad6.tar.gz
rust-16b7b39fdddff00c237c71e237881f835b43cad6.zip
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.
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 907a6b1c46c..110286255c5 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -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);