privacy: Rename some variables for clarity
This commit is contained in:
parent
95a24c6ed4
commit
98a86ffc9f
2 changed files with 10 additions and 10 deletions
|
@ -215,7 +215,7 @@ impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
|
|||
pub fn update(
|
||||
&mut self,
|
||||
id: Id,
|
||||
nominal_vis: Option<Visibility>,
|
||||
max_vis: Option<Visibility>,
|
||||
lazy_private_vis: impl FnOnce() -> Visibility,
|
||||
inherited_effective_vis: EffectiveVisibility,
|
||||
level: Level,
|
||||
|
@ -239,8 +239,8 @@ impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
|
|||
if !(inherited_effective_vis_at_prev_level == inherited_effective_vis_at_level
|
||||
&& level != l)
|
||||
{
|
||||
calculated_effective_vis = if let Some(nominal_vis) = nominal_vis && !nominal_vis.is_at_least(inherited_effective_vis_at_level, tcx) {
|
||||
nominal_vis
|
||||
calculated_effective_vis = if let Some(max_vis) = max_vis && !max_vis.is_at_least(inherited_effective_vis_at_level, tcx) {
|
||||
max_vis
|
||||
} else {
|
||||
inherited_effective_vis_at_level
|
||||
}
|
||||
|
|
|
@ -473,14 +473,14 @@ impl<'tcx> EmbargoVisitor<'tcx> {
|
|||
&mut self,
|
||||
def_id: LocalDefId,
|
||||
inherited_effective_vis: EffectiveVisibility,
|
||||
nominal_vis: Option<ty::Visibility>,
|
||||
max_vis: Option<ty::Visibility>,
|
||||
level: Level,
|
||||
) {
|
||||
let private_vis = ty::Visibility::Restricted(self.tcx.parent_module_from_def_id(def_id));
|
||||
if Some(private_vis) != nominal_vis {
|
||||
if max_vis != Some(private_vis) {
|
||||
self.changed |= self.effective_visibilities.update(
|
||||
def_id,
|
||||
nominal_vis,
|
||||
max_vis,
|
||||
|| private_vis,
|
||||
inherited_effective_vis,
|
||||
level,
|
||||
|
@ -774,9 +774,9 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
|
|||
|
||||
for impl_item_ref in impl_.items {
|
||||
let def_id = impl_item_ref.id.owner_id.def_id;
|
||||
let nominal_vis =
|
||||
let max_vis =
|
||||
impl_.of_trait.is_none().then(|| self.tcx.local_visibility(def_id));
|
||||
self.update_eff_vis(def_id, item_ev, nominal_vis, Level::Direct);
|
||||
self.update_eff_vis(def_id, item_ev, max_vis, Level::Direct);
|
||||
|
||||
if let Some(impl_item_ev) = self.get(def_id) {
|
||||
self.reach(def_id, impl_item_ev).generics().predicates().ty();
|
||||
|
@ -897,9 +897,9 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>
|
|||
// All effective visibilities except `reachable_through_impl_trait` are limited to
|
||||
// nominal visibility. If any type or trait is leaked farther than that, it will
|
||||
// produce type privacy errors on any use, so we don't consider it leaked.
|
||||
let nominal_vis = (self.level != Level::ReachableThroughImplTrait)
|
||||
let max_vis = (self.level != Level::ReachableThroughImplTrait)
|
||||
.then(|| self.ev.tcx.local_visibility(def_id));
|
||||
self.ev.update_eff_vis(def_id, self.effective_vis, nominal_vis, self.level);
|
||||
self.ev.update_eff_vis(def_id, self.effective_vis, max_vis, self.level);
|
||||
}
|
||||
ControlFlow::Continue(())
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue