about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-06 20:25:17 +0000
committerbors <bors@rust-lang.org>2023-12-06 20:25:17 +0000
commit1fdfe1234795a289af1088aefa92ef80191cb611 (patch)
tree8deb5b693bd13372191a7a6eab3ad89b35fad303
parent7a34091eed9adcb079035357ffaf2467b0d377fc (diff)
parent940473adb423cc5e1d77a4d3cffeb617283e337c (diff)
downloadrust-1fdfe1234795a289af1088aefa92ef80191cb611.tar.gz
rust-1fdfe1234795a289af1088aefa92ef80191cb611.zip
Auto merge of #117936 - mu001999:master, r=petrochenkov
Use the glob binding in resolve_rustdoc_path process

Fixes #117920

Returning `None` seems enough.

I reproduces and tests this locally by `cargo +stage1 build`, but I cannot reproduce this ICE by putting [the following code](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=8b3ca8f4a7676eb90baf30437ba041a2) into `tests/ui/...` and then compiling it using `rustc +stage1 /path/to/test.rs` or `x.py test`:
```rust
#![crate_type = "lib"]

use super::Hasher;

/// [`Hasher`]
pub use core::hash::*;
```

r? `@petrochenkov`
-rw-r--r--compiler/rustc_resolve/src/imports.rs3
-rw-r--r--tests/ui/resolve/issue-117920.rs11
-rw-r--r--tests/ui/resolve/issue-117920.stderr9
3 files changed, 23 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs
index b28ad671f12..c2306e3ea7d 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 00000000000..928f194c59c
--- /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 00000000000..c4528d467e9
--- /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`.