make per-point liveness accessible
It avoids round-tripping through `Location`s if you're working with `Point`s already.
This commit is contained in:
parent
d7daac06d8
commit
be204dd047
2 changed files with 10 additions and 3 deletions
|
|
@ -182,8 +182,7 @@ impl LocalizedConstraintGraphVisitor for LoanLivenessVisitor<'_> {
|
|||
//
|
||||
// FIXME: analyze potential unsoundness, possibly in concert with a borrowck
|
||||
// implementation in a-mir-formality, fuzzing, or manually crafting counter-examples.
|
||||
let location = self.liveness.location_from_point(node.point);
|
||||
if self.liveness.is_live_at(node.region, location) {
|
||||
if self.liveness.is_live_at_point(node.region, node.point) {
|
||||
self.live_loans.insert(node.point, loan);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,9 +131,17 @@ impl LivenessValues {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns whether `region` is marked live at the given `location`.
|
||||
/// Returns whether `region` is marked live at the given
|
||||
/// [`location`][rustc_middle::mir::Location].
|
||||
pub(crate) fn is_live_at(&self, region: RegionVid, location: Location) -> bool {
|
||||
let point = self.location_map.point_from_location(location);
|
||||
self.is_live_at_point(region, point)
|
||||
}
|
||||
|
||||
/// Returns whether `region` is marked live at the given
|
||||
/// [`point`][rustc_mir_dataflow::points::PointIndex].
|
||||
#[inline]
|
||||
pub(crate) fn is_live_at_point(&self, region: RegionVid, point: PointIndex) -> bool {
|
||||
if let Some(points) = &self.points {
|
||||
points.row(region).is_some_and(|r| r.contains(point))
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue