Skip to content

Commit b03635d

Browse files
amandasystemslcnr
andcommitted
Minor code review nits
Co-authored-by: lcnr <[email protected]>
1 parent 0328df9 commit b03635d

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

compiler/rustc_borrowck/src/region_infer/graphviz.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ use super::*;
1313

1414
fn render_outlives_constraint(constraint: &OutlivesConstraint<'_>) -> String {
1515
if let ConstraintCategory::OutlivesUnnameablePlaceholder(from, to) = constraint.category {
16-
return format!("b/c {from:?}: {to:?}");
17-
}
18-
match constraint.locations {
19-
Locations::All(_) => "All(...)".to_string(),
20-
Locations::Single(loc) => format!("{loc:?}"),
16+
format!("b/c {from:?}: {to:?}")
17+
} else {
18+
match constraint.locations {
19+
Locations::All(_) => "All(...)".to_string(),
20+
Locations::Single(loc) => format!("{loc:?}"),
21+
}
2122
}
2223
}
2324

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1736,7 +1736,6 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17361736
trace!(scc = ?self.constraint_sccs.scc(fr1));
17371737
trace!(universe = ?self.max_nameable_universe(self.constraint_sccs.scc(fr1)));
17381738
self.constraint_path_to(fr1, |r| {
1739-
// First look for some `r` such that `fr1: r` and `r` is live at `location`
17401739
trace!(?r, liveness_constraints=?self.liveness_constraints.pretty_print_live_points(r));
17411740
self.liveness_constraints.is_live_at(r, location)
17421741
}, true).unwrap().1
@@ -1796,13 +1795,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
17961795

17971796
// If we are passing through a constraint added because `'lt: 'unnameable`,
17981797
// where cannot name `'unnameable`, redirect search towards `'unnameable`.
1799-
let path = if let Some((lt, unnameable)) = path.iter().find_map(|c| {
1798+
let due_to_placeholder_outlives = path.iter().find_map(|c| {
18001799
if let ConstraintCategory::OutlivesUnnameablePlaceholder(lt, unnameable) = c.category {
18011800
Some((lt, unnameable))
18021801
} else {
18031802
None
18041803
}
1805-
}) {
1804+
});
1805+
let path = if let Some((lt, unnameable)) = due_to_placeholder_outlives {
18061806
// This the `false` argument is what prevents circular reasoning here!
18071807
self.constraint_path_to(lt, |r| r == unnameable, false).unwrap().0
18081808
} else {

0 commit comments

Comments
 (0)