Skip to content

Commit eea5cf8

Browse files
committed
Code review: rename the method min_universe()
1 parent b3ef0e8 commit eea5cf8

File tree

1 file changed

+9
-7
lines changed
  • compiler/rustc_borrowck/src/region_infer

1 file changed

+9
-7
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ impl RegionTracker {
116116
representative_is_existential,
117117
}
118118
}
119-
fn universe(self) -> UniverseIndex {
119+
120+
/// The smallest-indexed universe reachable from and/or in this SCC.
121+
fn min_universe(self) -> UniverseIndex {
120122
self.min_reachable_universe
121123
}
122124

@@ -133,7 +135,7 @@ impl RegionTracker {
133135
/// Returns `true` if during the annotated SCC reaches a placeholder
134136
/// with a universe larger than the smallest reachable one, `false` otherwise.
135137
pub(crate) fn has_incompatible_universes(&self) -> bool {
136-
self.universe().cannot_name(self.max_placeholder_universe_reached)
138+
self.min_universe().cannot_name(self.max_placeholder_universe_reached)
137139
}
138140
}
139141

@@ -780,7 +782,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
780782
// If the member region lives in a higher universe, we currently choose
781783
// the most conservative option by leaving it unchanged.
782784

783-
if !self.constraint_sccs().annotation(scc).universe().is_root() {
785+
if !self.constraint_sccs().annotation(scc).min_universe().is_root() {
784786
return;
785787
}
786788

@@ -854,12 +856,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
854856
fn universe_compatible(&self, scc_b: ConstraintSccIndex, scc_a: ConstraintSccIndex) -> bool {
855857
let a_annotation = self.constraint_sccs().annotation(scc_a);
856858
let b_annotation = self.constraint_sccs().annotation(scc_b);
857-
let a_universe = a_annotation.universe();
859+
let a_universe = a_annotation.min_universe();
858860

859861
// If scc_b's declared universe is a subset of
860862
// scc_a's declared universe (typically, both are ROOT), then
861863
// it cannot contain any problematic universe elements.
862-
if a_universe.can_name(b_annotation.universe()) {
864+
if a_universe.can_name(b_annotation.min_universe()) {
863865
return true;
864866
}
865867

@@ -973,7 +975,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
973975
"lower_bound = {:?} r_scc={:?} universe={:?}",
974976
lower_bound,
975977
r_scc,
976-
self.constraint_sccs.annotation(r_scc).universe()
978+
self.constraint_sccs.annotation(r_scc).min_universe()
977979
);
978980

979981
// If the type test requires that `T: 'a` where `'a` is a
@@ -1490,7 +1492,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14901492
/// The minimum universe of any variable reachable from this
14911493
/// SCC, inside or outside of it.
14921494
fn scc_universe(&self, scc: ConstraintSccIndex) -> UniverseIndex {
1493-
self.constraint_sccs().annotation(scc).universe()
1495+
self.constraint_sccs().annotation(scc).min_universe()
14941496
}
14951497
/// Checks the final value for the free region `fr` to see if it
14961498
/// grew too large. In particular, examine what `end(X)` points

0 commit comments

Comments
 (0)