Partially revert "resolve: Update NameBindingData::vis in place"

(cherry picked from commit 324267ccaa)
This commit is contained in:
Vadim Petrochenkov 2026-02-11 22:23:57 +03:00 committed by Josh Stone
parent bcfdf1bf97
commit a096799b4a
5 changed files with 10 additions and 22 deletions

View file

@ -401,8 +401,9 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
}
} else if !old_glob_decl.vis().is_at_least(glob_decl.vis(), self.tcx) {
// We are glob-importing the same item but with greater visibility.
old_glob_decl.vis.set_unchecked(glob_decl.vis());
old_glob_decl
// FIXME: Update visibility in place, but without regressions
// (#152004, #151124, #152347).
glob_decl
} else if glob_decl.is_ambiguity_recursive() && !old_glob_decl.is_ambiguity_recursive() {
// Overwriting a non-ambiguous glob import with an ambiguous glob import.
old_glob_decl.ambiguity.set_unchecked(Some(glob_decl));

View file

@ -1,5 +1,6 @@
// Regression test for issue #152347.
//@ check-pass
//@ edition: 2018..
use outer::*; // must be before `mod outer`
@ -13,5 +14,5 @@ mod outer {
}
fn main() {
f(); //~ ERROR cannot find function `f` in this scope
f();
}

View file

@ -1,14 +0,0 @@
error[E0425]: cannot find function `f` in this scope
--> $DIR/overwrite-different-vis-2.rs:16:5
|
LL | f();
| ^ not found in this scope
|
help: consider importing this function through its public re-export
|
LL + use crate::outer::f;
|
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0425`.

View file

@ -6,7 +6,7 @@ mod m {
pub struct S {}
}
use m::*;
pub use m::*; //~ ERROR unused import: `m::*`
use m::*; //~ ERROR unused import: `m::*`
pub use m::*;
fn main() {}

View file

@ -1,8 +1,8 @@
error: unused import: `m::*`
--> $DIR/overwrite-vis-unused.rs:10:9
--> $DIR/overwrite-vis-unused.rs:9:5
|
LL | pub use m::*;
| ^^^^
LL | use m::*;
| ^^^^
|
note: the lint level is defined here
--> $DIR/overwrite-vis-unused.rs:3:9