Skip to content

Commit d274005

Browse files
committed
regions do not contain liveness elements
1 parent 630299d commit d274005

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

compiler/rustc_borrowck/src/region_infer/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1963,15 +1963,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
19631963
None
19641964
}
19651965

1966-
/// Finds some region R such that `fr1: R` and `R` is live at `elem`.
1966+
/// Finds some region R such that `fr1: R` and `R` is live at `location`.
19671967
#[instrument(skip(self), level = "trace", ret)]
1968-
pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, elem: Location) -> RegionVid {
1968+
pub(crate) fn find_sub_region_live_at(&self, fr1: RegionVid, location: Location) -> RegionVid {
19691969
trace!(scc = ?self.constraint_sccs.scc(fr1));
19701970
trace!(universe = ?self.scc_universes[self.constraint_sccs.scc(fr1)]);
19711971
self.find_constraint_paths_between_regions(fr1, |r| {
1972-
// First look for some `r` such that `fr1: r` and `r` is live at `elem`
1972+
// First look for some `r` such that `fr1: r` and `r` is live at `location`
19731973
trace!(?r, liveness_constraints=?self.liveness_constraints.region_value_str(r));
1974-
self.liveness_constraints.contains(r, elem)
1974+
self.liveness_constraints.is_live_at(r, location)
19751975
})
19761976
.or_else(|| {
19771977
// If we fail to find that, we may find some `r` such that

compiler/rustc_borrowck/src/region_infer/values.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ impl<N: Idx> LivenessValues<N> {
154154
self.points.insert_all_into_row(region);
155155
}
156156

157-
/// Returns `true` if the region `region` contains the given element.
158-
pub(crate) fn contains(&self, region: N, location: Location) -> bool {
159-
let index = self.elements.point_from_location(location);
160-
self.points.row(region).is_some_and(|r| r.contains(index))
157+
/// Returns whether `region` is marked live at the given `location`.
158+
pub(crate) fn is_live_at(&self, region: N, location: Location) -> bool {
159+
let point = self.elements.point_from_location(location);
160+
self.points.row(region).is_some_and(|r| r.contains(point))
161161
}
162162

163163
/// Returns an iterator of all the elements contained by `region`.

0 commit comments

Comments
 (0)