Skip to content

Commit 98a86ff

Browse files
committed
privacy: Rename some variables for clarity
1 parent 95a24c6 commit 98a86ff

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

compiler/rustc_middle/src/middle/privacy.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
215215
pub fn update(
216216
&mut self,
217217
id: Id,
218-
nominal_vis: Option<Visibility>,
218+
max_vis: Option<Visibility>,
219219
lazy_private_vis: impl FnOnce() -> Visibility,
220220
inherited_effective_vis: EffectiveVisibility,
221221
level: Level,
@@ -239,8 +239,8 @@ impl<Id: Eq + Hash> EffectiveVisibilities<Id> {
239239
if !(inherited_effective_vis_at_prev_level == inherited_effective_vis_at_level
240240
&& level != l)
241241
{
242-
calculated_effective_vis = if let Some(nominal_vis) = nominal_vis && !nominal_vis.is_at_least(inherited_effective_vis_at_level, tcx) {
243-
nominal_vis
242+
calculated_effective_vis = if let Some(max_vis) = max_vis && !max_vis.is_at_least(inherited_effective_vis_at_level, tcx) {
243+
max_vis
244244
} else {
245245
inherited_effective_vis_at_level
246246
}

compiler/rustc_privacy/src/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,14 @@ impl<'tcx> EmbargoVisitor<'tcx> {
473473
&mut self,
474474
def_id: LocalDefId,
475475
inherited_effective_vis: EffectiveVisibility,
476-
nominal_vis: Option<ty::Visibility>,
476+
max_vis: Option<ty::Visibility>,
477477
level: Level,
478478
) {
479479
let private_vis = ty::Visibility::Restricted(self.tcx.parent_module_from_def_id(def_id));
480-
if Some(private_vis) != nominal_vis {
480+
if max_vis != Some(private_vis) {
481481
self.changed |= self.effective_visibilities.update(
482482
def_id,
483-
nominal_vis,
483+
max_vis,
484484
|| private_vis,
485485
inherited_effective_vis,
486486
level,
@@ -774,9 +774,9 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> {
774774

775775
for impl_item_ref in impl_.items {
776776
let def_id = impl_item_ref.id.owner_id.def_id;
777-
let nominal_vis =
777+
let max_vis =
778778
impl_.of_trait.is_none().then(|| self.tcx.local_visibility(def_id));
779-
self.update_eff_vis(def_id, item_ev, nominal_vis, Level::Direct);
779+
self.update_eff_vis(def_id, item_ev, max_vis, Level::Direct);
780780

781781
if let Some(impl_item_ev) = self.get(def_id) {
782782
self.reach(def_id, impl_item_ev).generics().predicates().ty();
@@ -897,9 +897,9 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx>
897897
// All effective visibilities except `reachable_through_impl_trait` are limited to
898898
// nominal visibility. If any type or trait is leaked farther than that, it will
899899
// produce type privacy errors on any use, so we don't consider it leaked.
900-
let nominal_vis = (self.level != Level::ReachableThroughImplTrait)
900+
let max_vis = (self.level != Level::ReachableThroughImplTrait)
901901
.then(|| self.ev.tcx.local_visibility(def_id));
902-
self.ev.update_eff_vis(def_id, self.effective_vis, nominal_vis, self.level);
902+
self.ev.update_eff_vis(def_id, self.effective_vis, max_vis, self.level);
903903
}
904904
ControlFlow::Continue(())
905905
}

0 commit comments

Comments
 (0)