Skip to content

Commit 317fb36

Browse files
committed
Some more code cleanup
1 parent 91c6e9a commit 317fb36

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

compiler/rustc_borrowck/src/handle_placeholders.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -175,18 +175,6 @@ impl RegionTracker {
175175
pub(crate) fn max_placeholder_universe_reached(self) -> UniverseIndex {
176176
self.reachable_placeholders.map(|p| p.max_universe.u).unwrap_or(UniverseIndex::ROOT)
177177
}
178-
179-
/// Determine if we can name all the placeholders in `other`.
180-
pub(crate) fn can_name_all_placeholders(&self, other: Self) -> bool {
181-
self.min_max_nameable_universe.can_name(other.max_placeholder_universe_reached())
182-
}
183-
184-
/// If this SCC reaches at least one placeholder, return
185-
/// its region vid. If there's more than one, return the one
186-
/// with the smallest vid.
187-
pub(crate) fn reached_placeholder(&self) -> Option<RegionVid> {
188-
self.reachable_placeholders.map(|p| p.min_placeholder)
189-
}
190178
}
191179

192180
impl scc::Annotation for RegionTracker {
@@ -405,7 +393,7 @@ pub(crate) fn rewrite_placeholder_outlives<'tcx>(
405393
}
406394

407395
if annotation.min_max_nameable_universe.can_name(max_universe.u) {
408-
debug!("All placeholders nameable from {scc:?}!");
396+
trace!("All placeholders nameable from {scc:?}!");
409397
continue;
410398
}
411399

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
499499
scc_a: ConstraintSccIndex,
500500
scc_b: ConstraintSccIndex,
501501
) -> bool {
502-
self.scc_annotations[scc_a].can_name_all_placeholders(self.scc_annotations[scc_b])
502+
self.scc_annotations[scc_a]
503+
.max_nameable_universe()
504+
.can_name(self.scc_annotations[scc_b].max_placeholder_universe_reached())
503505
}
504506

505507
/// Once regions have been propagated, this method is used to see
@@ -611,10 +613,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
611613
//
612614
// It doesn't matter *what* universe because the promoted `T` will
613615
// always be in the root universe.
614-
if let Some(min_placeholder) = self.scc_annotations[r_scc].reached_placeholder() {
615-
debug!(
616-
"encountered placeholder in higher universe: {min_placeholder:?}, requiring 'static"
617-
);
616+
if !self.scc_annotations[r_scc].max_placeholder_universe_reached().is_root() {
617+
debug!("encountered placeholder in higher universe, requiring 'static");
618618
let static_r = self.universal_regions().fr_static;
619619
propagated_outlives_requirements.push(ClosureOutlivesRequirement {
620620
subject,

0 commit comments

Comments
 (0)