From f767f2297d863dc64117a4f1739094fd2a887fa4 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sat, 15 Oct 2022 22:37:31 +0400 Subject: [PATCH] resolve: Shadow erroneous glob imports with erroneous single imports --- compiler/rustc_resolve/src/imports.rs | 2 +- src/test/rustdoc/issue-100241.rs | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/test/rustdoc/issue-100241.rs 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;