diff options
| author | bors <bors@rust-lang.org> | 2022-10-17 02:06:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-17 02:06:25 +0000 |
| commit | 1536ab1b383f21b38f8d49230a2aecc51daffa3d (patch) | |
| tree | 26a2856f4fac6a46146662d5f52cc28421834db8 | |
| parent | a501e6699ed979ef0540949211fc28256336a3f3 (diff) | |
| parent | f767f2297d863dc64117a4f1739094fd2a887fa4 (diff) | |
| download | rust-1536ab1b383f21b38f8d49230a2aecc51daffa3d.tar.gz rust-1536ab1b383f21b38f8d49230a2aecc51daffa3d.zip | |
Auto merge of #103096 - petrochenkov:indresdoc, r=cjgillot
resolve: Shadow erroneous glob imports with erroneous single imports If such shadowing doesn't happen we end up in a weird state that may cause ICEs. (In non-erroneous cases single imports always shadow glob imports too.) Fixes https://github.com/rust-lang/rust/issues/100047 Fixes https://github.com/rust-lang/rust/issues/100241
| -rw-r--r-- | compiler/rustc_resolve/src/imports.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-100241.rs | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/rustc_resolve/src/imports.rs b/compiler/rustc_resolve/src/imports.rs index 9e2234ae4a5..0a86374d76d 100644 --- a/compiler/rustc_resolve/src/imports.rs +++ b/compiler/rustc_resolve/src/imports.rs @@ -252,7 +252,7 @@ impl<'a> Resolver<'a> { self.set_binding_parent_module(binding, module); self.update_resolution(module, key, |this, resolution| { if let Some(old_binding) = resolution.binding { - if res == Res::Err { + if res == Res::Err && old_binding.res() != Res::Err { // Do not override real bindings with `Res::Err`s from error recovery. return Ok(()); } diff --git a/src/test/rustdoc/issue-100241.rs b/src/test/rustdoc/issue-100241.rs new file mode 100644 index 00000000000..9e9cba13a22 --- /dev/null +++ b/src/test/rustdoc/issue-100241.rs @@ -0,0 +1,12 @@ +//! See [`S`]. + +// Check that this isn't an ICE +// should-fail + +mod foo { + pub use inner::S; + //~^ ERROR unresolved imports `inner`, `foo::S` +} + +use foo::*; +use foo::S; |
