Skip to content

Commit 43d3ecf

Browse files
committed
encapsulate access to liveness values
1 parent 6058f5e commit 43d3ecf

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

compiler/rustc_borrowck/src/dataflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'a, 'tcx> PoloniusOutOfScopePrecomputer<'a, 'tcx> {
286286
.collect();
287287

288288
// Pre-compute the set of live SCCs per point
289-
let liveness = &regioncx.liveness_constraints;
289+
let liveness = regioncx.liveness_values();
290290
let mut live_sccs_per_point = SparseBitMatrix::new(num_sccs);
291291

292292
for region in liveness.rows() {
@@ -405,7 +405,7 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
405405
// `q`. The reachability is location-insensitive, and we could take advantage of
406406
// that, by jumping to a further point than the next statement. We can jump to the
407407
// furthest point within the block where `r` is live.
408-
let point = self.regioncx.liveness_constraints.point_from_location(location);
408+
let point = self.regioncx.liveness_values().point_from_location(location);
409409
if let Some(live_sccs) = self.live_sccs_per_point.row(point) {
410410
for live_scc in live_sccs.iter() {
411411
if self.reachability.contains(live_scc) {

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub struct RegionInferenceContext<'tcx> {
5858
/// regions, these start out empty and steadily grow, though for
5959
/// each universally quantified region R they start out containing
6060
/// the entire CFG and `end(R)`.
61-
pub(crate) liveness_constraints: LivenessValues<RegionVid>,
61+
liveness_constraints: LivenessValues<RegionVid>,
6262

6363
/// The outlives constraints computed by the type-check.
6464
constraints: Frozen<OutlivesConstraintSet<'tcx>>,
@@ -2284,6 +2284,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
22842284
pub(crate) fn constraint_sccs(&self) -> &Sccs<RegionVid, ConstraintSccIndex> {
22852285
self.constraint_sccs.as_ref()
22862286
}
2287+
2288+
/// Access to the liveness values.
2289+
pub(crate) fn liveness_values(&self) -> &LivenessValues<RegionVid> {
2290+
&self.liveness_constraints
2291+
}
22872292
}
22882293

22892294
impl<'tcx> RegionDefinition<'tcx> {

0 commit comments

Comments
 (0)