regions do not contain liveness elements

This commit is contained in:
Rémy Rakic 2023-11-13 14:58:16 +00:00
parent c8feeb6ced
commit 23bc9c6a62
2 changed files with 8 additions and 8 deletions

View File

@ -1963,15 +1963,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
None None
} }
/// Finds some region R such that `fr1: R` and `R` is live at `elem`. /// Finds some region R such that `fr1: R` and `R` is live at `location`.
#[instrument(skip(self), level = "trace", ret)] #[instrument(skip(self), level = "trace", ret)]
pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, elem: Location) -> RegionVid { pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, location: Location) -> RegionVid {
trace!(scc = ?self.constraint_sccs.scc(fr1)); trace!(scc = ?self.constraint_sccs.scc(fr1));
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]); trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
self.find_constraint_paths_between_regions(fr1, |r| { self.find_constraint_paths_between_regions(fr1, |r| {
// First look for some `r` such that `fr1: r` and `r` is live at `elem` // First look for some `r` such that `fr1: r` and `r` is live at `location`
trace!(?r, liveness_constraints=?self.liveness_constraints.region_value_str(r)); trace!(?r, liveness_constraints=?self.liveness_constraints.region_value_str(r));
self.liveness_constraints.contains(r, elem) self.liveness_constraints.is_live_at(r, location)
}) })
.or_else(|| { .or_else(|| {
// If we fail to find that, we may find some `r` such that // If we fail to find that, we may find some `r` such that

View File

@ -154,10 +154,10 @@ impl<N: Idx> LivenessValues<N> {
self.points.insert_all_into_row(region); self.points.insert_all_into_row(region);
} }
/// Returns `true` if the region `region` contains the given element. /// Returns whether `region` is marked live at the given `location`.
pub(crate) fn contains(&self, region: N, location: Location) -> bool { pub(crate) fn is_live_at(&self, region: N, location: Location) -> bool {
let index = self.elements.point_from_location(location); let point = self.elements.point_from_location(location);
self.points.row(region).is_some_and(|r| r.contains(index)) self.points.row(region).is_some_and(|r| r.contains(point))
} }
/// Returns an iterator of all the elements contained by `region`. /// Returns an iterator of all the elements contained by `region`.