about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorbohan <bohan-zhang@foxmail.com>2024-06-06 16:09:20 +0800
committerbohan <bohan-zhang@foxmail.com>2024-06-07 21:23:56 +0800
commit93feaa668511cfd03a645217a2287699694002cf (patch)
treea1c8b4af94050854f2e75606dd84884f428692fe /compiler/rustc_resolve/src
parent1be24d70ced0d6b8d41a48b6a28b3790f6facf4c (diff)
downloadrust-93feaa668511cfd03a645217a2287699694002cf.tar.gz
rust-93feaa668511cfd03a645217a2287699694002cf.zip
mark binding undetermined if target name exist and not obtained
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/ident.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs
index 78bd3c4e49f..b6a23317dc9 100644
--- a/compiler/rustc_resolve/src/ident.rs
+++ b/compiler/rustc_resolve/src/ident.rs
@@ -998,14 +998,14 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
             let Some(module) = single_import.imported_module.get() else {
                 return Err((Undetermined, Weak::No));
             };
-            let ImportKind::Single { source: ident, source_bindings, .. } = &single_import.kind
+            let ImportKind::Single { source: ident, target, target_bindings, .. } =
+                &single_import.kind
             else {
                 unreachable!();
             };
-            if binding.map_or(false, |binding| binding.module().is_some())
-                && source_bindings.iter().all(|binding| matches!(binding.get(), Err(Undetermined)))
-            {
-                // This branch allows the binding to be defined or updated later,
+            if (ident != target) && target_bindings.iter().all(|binding| binding.get().is_none()) {
+                // This branch allows the binding to be defined or updated later if the target name
+                // can hide the source but these bindings are not obtained.
                 // avoiding module inconsistency between the resolve process and the finalize process.
                 // See more details in #124840
                 return Err((Undetermined, Weak::No));