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
This commit is contained in:
bors 2022-10-17 02:06:25 +00:00
commit 1536ab1b38
2 changed files with 13 additions and 1 deletions

View File

@ -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(());
}

View File

@ -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;