File tree 2 files changed +8
-4
lines changed
compiler/rustc_borrowck/src
2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -330,7 +330,6 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
330
330
// region that outlives free regions via outlives constraints.)
331
331
332
332
let sccs = self . regioncx . constraint_sccs ( ) ;
333
- let member_constraints = & self . regioncx . member_constraints ;
334
333
335
334
let issuing_region_scc = sccs. scc ( issuing_region) ;
336
335
self . reachability_stack . push ( issuing_region_scc) ;
@@ -352,15 +351,15 @@ impl<'tcx> PoloniusOutOfScopePrecomputer<'_, 'tcx> {
352
351
//
353
352
// If the issuing region outlives such a region, its loan escapes the function and
354
353
// cannot go out of scope. We can early return.
355
- if member_constraints . indices ( scc ) . next ( ) . is_some ( )
354
+ if self . regioncx . scc_has_member_constraints ( scc )
356
355
|| self . sccs_live_at_all_points . contains ( & scc)
357
356
{
358
357
self . reachability_stack . clear ( ) ;
359
358
self . reachability . clear ( ) ;
360
359
return ;
361
360
}
362
361
363
- // 3. Via outlives successors, which we want to record and traverse, so we add them
362
+ // 3. Via outlives successors, which we want to record and traverse: we add them
364
363
// to the worklist stack
365
364
for & succ_scc in sccs. successors ( scc) {
366
365
if self . reachability . insert ( succ_scc) {
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ pub struct RegionInferenceContext<'tcx> {
79
79
rev_scc_graph : Option < ReverseSccGraph > ,
80
80
81
81
/// The "R0 member of [R1..Rn]" constraints, indexed by SCC.
82
- pub ( crate ) member_constraints : Rc < MemberConstraintSet < ' tcx , ConstraintSccIndex > > ,
82
+ member_constraints : Rc < MemberConstraintSet < ' tcx , ConstraintSccIndex > > ,
83
83
84
84
/// Records the member constraints that we applied to each scc.
85
85
/// This is useful for error reporting. Once constraint
@@ -2289,6 +2289,11 @@ impl<'tcx> RegionInferenceContext<'tcx> {
2289
2289
pub ( crate ) fn liveness_values ( & self ) -> & LivenessValues < RegionVid > {
2290
2290
& self . liveness_constraints
2291
2291
}
2292
+
2293
+ /// Returns whether the given SCC has any member constraints.
2294
+ pub ( crate ) fn scc_has_member_constraints ( & self , scc : ConstraintSccIndex ) -> bool {
2295
+ self . member_constraints . indices ( scc) . next ( ) . is_some ( )
2296
+ }
2292
2297
}
2293
2298
2294
2299
impl < ' tcx > RegionDefinition < ' tcx > {
You can’t perform that action at this time.
0 commit comments