From 940473adb423cc5e1d77a4d3cffeb617283e337c Mon Sep 17 00:00:00 2001 From: r0cky Date: Wed, 6 Dec 2023 21:48:19 +0800 Subject: [PATCH] Use the glob binding in resolve_rustdoc_path process --- compiler/rustc_resolve/src/imports.rs | 3 +++ tests/ui/resolve/issue-117920.rs | 11 +++++++++++ tests/ui/resolve/issue-117920.stderr | 9 +++++++++ 3 files changed, 23 insertions(+) create mode 100644 tests/ui/resolve/issue-117920.rs create mode 100644 tests/ui/resolve/issue-117920.stderr diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index b28ad671f1208..c2306e3ea7d44 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -477,6 +477,9 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { self.per_ns(|this, ns| { let key = BindingKey::new(target, ns); let _ = this.try_define(import.parent_scope.module, key, dummy_binding, false); + this.update_resolution(import.parent_scope.module, key, false, |_, resolution| { + resolution.single_imports.remove(&import); + }) }); self.record_use(target, dummy_binding, false); } else if import.imported_module.get().is_none() { diff --git a/tests/ui/resolve/issue-117920.rs b/tests/ui/resolve/issue-117920.rs new file mode 100644 index 0000000000000..928f194c59c3f --- /dev/null +++ b/tests/ui/resolve/issue-117920.rs @@ -0,0 +1,11 @@ +#![crate_type = "lib"] + +use super::A; //~ ERROR failed to resolve + +mod b { + pub trait A {} + pub trait B {} +} + +/// [`A`] +pub use b::*; diff --git a/tests/ui/resolve/issue-117920.stderr b/tests/ui/resolve/issue-117920.stderr new file mode 100644 index 0000000000000..c4528d467e9f5 --- /dev/null +++ b/tests/ui/resolve/issue-117920.stderr @@ -0,0 +1,9 @@ +error[E0433]: failed to resolve: there are too many leading `super` keywords + --> $DIR/issue-117920.rs:3:5 + | +LL | use super::A; + | ^^^^^ there are too many leading `super` keywords + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0433`.