1
Fork 0

effvis: Stop considering crate root its own parent

It helped to reuse `update_def` for the crate root, but it created confusion and caused some mistakes when I implemented #109500
This commit is contained in:
Vadim Petrochenkov 2023-03-28 22:18:02 +04:00
parent ede21e8932
commit b3bfeaf765
2 changed files with 11 additions and 8 deletions

View file

@ -6,7 +6,7 @@ use rustc_data_structures::fx::FxHashMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_macros::HashStable;
use rustc_query_system::ich::StableHashingContext;
use rustc_span::def_id::LocalDefId;
use rustc_span::def_id::{LocalDefId, CRATE_DEF_ID};
use std::hash::Hash;
/// Represents the levels of effective visibility an item can have.
@ -107,6 +107,10 @@ impl EffectiveVisibilities {
})
}
pub fn update_root(&mut self) {
self.map.insert(CRATE_DEF_ID, EffectiveVisibility::from_vis(Visibility::Public));
}
// FIXME: Share code with `fn update`.
pub fn update_eff_vis(
&mut self,