Skip to content

Commit 1536ab1

Browse files
committed
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 #100047 Fixes #100241
2 parents a501e66 + f767f22 commit 1536ab1

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/rustc_resolve/src/imports.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ impl<'a> Resolver<'a> {
252252
self.set_binding_parent_module(binding, module);
253253
self.update_resolution(module, key, |this, resolution| {
254254
if let Some(old_binding) = resolution.binding {
255-
if res == Res::Err {
255+
if res == Res::Err && old_binding.res() != Res::Err {
256256
// Do not override real bindings with `Res::Err`s from error recovery.
257257
return Ok(());
258258
}

src/test/rustdoc/issue-100241.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//! See [`S`].
2+
3+
// Check that this isn't an ICE
4+
// should-fail
5+
6+
mod foo {
7+
pub use inner::S;
8+
//~^ ERROR unresolved imports `inner`, `foo::S`
9+
}
10+
11+
use foo::*;
12+
use foo::S;

0 commit comments

Comments
 (0)