@@ -551,7 +551,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
551
551
mir_def_id : DefId ,
552
552
polonius_output : Option < Rc < PoloniusOutput > > ,
553
553
) -> ( Option < ClosureRegionRequirements < ' tcx > > , RegionErrors < ' tcx > ) {
554
- self . propagate_constraints ( body) ;
554
+ self . propagate_constraints ( body, infcx . tcx ) ;
555
555
556
556
let mut errors_buffer = RegionErrors :: new ( ) ;
557
557
@@ -599,7 +599,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
599
599
/// for each region variable until all the constraints are
600
600
/// satisfied. Note that some values may grow **too** large to be
601
601
/// feasible, but we check this later.
602
- fn propagate_constraints ( & mut self , _body : & Body < ' tcx > ) {
602
+ fn propagate_constraints ( & mut self , _body : & Body < ' tcx > , tcx : TyCtxt < ' tcx > ) {
603
603
debug ! ( "propagate_constraints()" ) ;
604
604
605
605
debug ! ( "propagate_constraints: constraints={:#?}" , {
@@ -617,7 +617,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
617
617
// own.
618
618
let constraint_sccs = self . constraint_sccs . clone ( ) ;
619
619
for scc in constraint_sccs. all_sccs ( ) {
620
- self . compute_value_for_scc ( scc) ;
620
+ self . compute_value_for_scc ( scc, tcx ) ;
621
621
}
622
622
623
623
// Sort the applied member constraints so we can binary search
@@ -629,7 +629,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
629
629
/// computed, by unioning the values of its successors.
630
630
/// Assumes that all successors have been computed already
631
631
/// (which is assured by iterating over SCCs in dependency order).
632
- fn compute_value_for_scc ( & mut self , scc_a : ConstraintSccIndex ) {
632
+ fn compute_value_for_scc ( & mut self , scc_a : ConstraintSccIndex , tcx : TyCtxt < ' tcx > ) {
633
633
let constraint_sccs = self . constraint_sccs . clone ( ) ;
634
634
635
635
// Walk each SCC `B` such that `A: B`...
@@ -652,7 +652,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
652
652
// Now take member constraints into account.
653
653
let member_constraints = self . member_constraints . clone ( ) ;
654
654
for m_c_i in member_constraints. indices ( scc_a) {
655
- self . apply_member_constraint ( scc_a, m_c_i, member_constraints. choice_regions ( m_c_i) ) ;
655
+ self . apply_member_constraint (
656
+ tcx,
657
+ scc_a,
658
+ m_c_i,
659
+ member_constraints. choice_regions ( m_c_i) ,
660
+ ) ;
656
661
}
657
662
658
663
debug ! (
@@ -675,6 +680,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
675
680
/// If we make any changes, returns true, else false.
676
681
fn apply_member_constraint (
677
682
& mut self ,
683
+ tcx : TyCtxt < ' tcx > ,
678
684
scc : ConstraintSccIndex ,
679
685
member_constraint_index : NllMemberConstraintIndex ,
680
686
choice_regions : & [ ty:: RegionVid ] ,
@@ -688,12 +694,15 @@ impl<'tcx> RegionInferenceContext<'tcx> {
688
694
// `impl_trait_in_bindings`, I believe, and we are just
689
695
// opting not to handle it for now. See #61773 for
690
696
// details.
691
- bug ! (
692
- "member constraint for `{:?}` has an option region `{:?}` \
693
- that is not a universal region",
694
- self . member_constraints[ member_constraint_index] . opaque_type_def_id,
695
- uh_oh,
697
+ tcx. sess . delay_span_bug (
698
+ self . member_constraints [ member_constraint_index] . definition_span ,
699
+ & format ! (
700
+ "member constraint for `{:?}` has an option region `{:?}` \
701
+ that is not a universal region",
702
+ self . member_constraints[ member_constraint_index] . opaque_type_def_id, uh_oh,
703
+ ) ,
696
704
) ;
705
+ return false ;
697
706
}
698
707
699
708
// Create a mutable vector of the options. We'll try to winnow
0 commit comments