Partially revert "resolve: Update NameBindingData::vis in place"
This commit is contained in:
parent
0cd0840243
commit
324267ccaa
5 changed files with 10 additions and 22 deletions
|
|
@ -406,8 +406,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));
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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`.
|
||||
|
|
@ -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() {}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue