@@ -552,6 +552,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
552
552
/// Performs region inference and report errors if we see any
553
553
/// unsatisfiable constraints. If this is a closure, returns the
554
554
/// region requirements to propagate to our creator, if any.
555
+ #[ instrument( skip( self , infcx, body, polonius_output) , level = "debug" ) ]
555
556
pub ( super ) fn solve (
556
557
& mut self ,
557
558
infcx : & InferCtxt < ' _ , ' tcx > ,
@@ -607,10 +608,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
607
608
/// for each region variable until all the constraints are
608
609
/// satisfied. Note that some values may grow **too** large to be
609
610
/// feasible, but we check this later.
611
+ #[ instrument( skip( self , _body) , level = "debug" ) ]
610
612
fn propagate_constraints ( & mut self , _body : & Body < ' tcx > ) {
611
- debug ! ( "propagate_constraints()" ) ;
612
-
613
- debug ! ( "propagate_constraints: constraints={:#?}" , {
613
+ debug ! ( "constraints={:#?}" , {
614
614
let mut constraints: Vec <_> = self . constraints. outlives( ) . iter( ) . collect( ) ;
615
615
constraints. sort( ) ;
616
616
constraints
@@ -637,12 +637,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
637
637
/// computed, by unioning the values of its successors.
638
638
/// Assumes that all successors have been computed already
639
639
/// (which is assured by iterating over SCCs in dependency order).
640
+ #[ instrument( skip( self ) , level = "debug" ) ]
640
641
fn compute_value_for_scc ( & mut self , scc_a : ConstraintSccIndex ) {
641
642
let constraint_sccs = self . constraint_sccs . clone ( ) ;
642
643
643
644
// Walk each SCC `B` such that `A: B`...
644
645
for & scc_b in constraint_sccs. successors ( scc_a) {
645
- debug ! ( "propagate_constraint_sccs: scc_a = {:?} scc_b = {:?}" , scc_a , scc_b) ;
646
+ debug ! ( ? scc_b) ;
646
647
647
648
// ...and add elements from `B` into `A`. One complication
648
649
// arises because of universes: If `B` contains something
@@ -663,11 +664,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
663
664
self . apply_member_constraint ( scc_a, m_c_i, member_constraints. choice_regions ( m_c_i) ) ;
664
665
}
665
666
666
- debug ! (
667
- "propagate_constraint_sccs: scc_a = {:?} has value {:?}" ,
668
- scc_a,
669
- self . scc_values. region_value_str( scc_a) ,
670
- ) ;
667
+ debug ! ( value = ?self . scc_values. region_value_str( scc_a) ) ;
671
668
}
672
669
673
670
/// Invoked for each `R0 member of [R1..Rn]` constraint.
@@ -681,14 +678,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
681
678
/// is considered a *lower bound*. If possible, we will modify
682
679
/// the constraint to set it equal to one of the option regions.
683
680
/// If we make any changes, returns true, else false.
681
+ #[ instrument( skip( self , member_constraint_index) , level = "debug" ) ]
684
682
fn apply_member_constraint (
685
683
& mut self ,
686
684
scc : ConstraintSccIndex ,
687
685
member_constraint_index : NllMemberConstraintIndex ,
688
686
choice_regions : & [ ty:: RegionVid ] ,
689
687
) -> bool {
690
- debug ! ( "apply_member_constraint(scc={:?}, choice_regions={:#?})" , scc, choice_regions, ) ;
691
-
692
688
// Create a mutable vector of the options. We'll try to winnow
693
689
// them down.
694
690
let mut choice_regions: Vec < ty:: RegionVid > = choice_regions. to_vec ( ) ;
@@ -714,7 +710,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
714
710
. universal_regions_outlived_by ( scc)
715
711
. all ( |lb| self . universal_region_relations . outlives ( o_r, lb) )
716
712
} ) ;
717
- debug ! ( "apply_member_constraint: after lb, choice_regions={:?}" , choice_regions ) ;
713
+ debug ! ( ?choice_regions , " after lb" ) ;
718
714
719
715
// Now find all the *upper bounds* -- that is, each UB is a
720
716
// free region that must outlive the member region `R0` (`UB:
@@ -723,10 +719,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
723
719
let rev_scc_graph = self . reverse_scc_graph ( ) ;
724
720
let universal_region_relations = & self . universal_region_relations ;
725
721
for ub in rev_scc_graph. upper_bounds ( scc) {
726
- debug ! ( "apply_member_constraint: ub={:?}" , ub) ;
722
+ debug ! ( ? ub) ;
727
723
choice_regions. retain ( |& o_r| universal_region_relations. outlives ( ub, o_r) ) ;
728
724
}
729
- debug ! ( "apply_member_constraint: after ub, choice_regions={:?}" , choice_regions ) ;
725
+ debug ! ( ?choice_regions , " after ub" ) ;
730
726
731
727
// If we ruled everything out, we're done.
732
728
if choice_regions. is_empty ( ) {
@@ -735,7 +731,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
735
731
736
732
// Otherwise, we need to find the minimum remaining choice, if
737
733
// any, and take that.
738
- debug ! ( "apply_member_constraint: choice_regions remaining are {:#?}" , choice_regions) ;
734
+ debug ! ( "choice_regions remaining are {:#?}" , choice_regions) ;
739
735
let min = |r1 : ty:: RegionVid , r2 : ty:: RegionVid | -> Option < ty:: RegionVid > {
740
736
let r1_outlives_r2 = self . universal_region_relations . outlives ( r1, r2) ;
741
737
let r2_outlives_r1 = self . universal_region_relations . outlives ( r2, r1) ;
@@ -748,27 +744,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
748
744
} ;
749
745
let mut min_choice = choice_regions[ 0 ] ;
750
746
for & other_option in & choice_regions[ 1 ..] {
751
- debug ! (
752
- "apply_member_constraint: min_choice={:?} other_option={:?}" ,
753
- min_choice, other_option,
754
- ) ;
747
+ debug ! ( ?min_choice, ?other_option, ) ;
755
748
match min ( min_choice, other_option) {
756
749
Some ( m) => min_choice = m,
757
750
None => {
758
- debug ! (
759
- "apply_member_constraint: {:?} and {:?} are incomparable; no min choice" ,
760
- min_choice, other_option,
761
- ) ;
751
+ debug ! ( ?min_choice, ?other_option, "incomparable; no min choice" , ) ;
762
752
return false ;
763
753
}
764
754
}
765
755
}
766
756
767
757
let min_choice_scc = self . constraint_sccs . scc ( min_choice) ;
768
- debug ! (
769
- "apply_member_constraint: min_choice={:?} best_choice_scc={:?}" ,
770
- min_choice, min_choice_scc,
771
- ) ;
758
+ debug ! ( ?min_choice, ?min_choice_scc) ;
772
759
if self . scc_values . add_region ( scc, min_choice_scc) {
773
760
self . member_constraints_applied . push ( AppliedMemberConstraint {
774
761
member_region_scc : scc,
@@ -1091,8 +1078,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1091
1078
/// include the CFG anyhow.
1092
1079
/// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
1093
1080
/// a result `'y`.
1081
+ #[ instrument( skip( self ) , level = "debug" ) ]
1094
1082
pub ( crate ) fn universal_upper_bound ( & self , r : RegionVid ) -> RegionVid {
1095
- debug ! ( "universal_upper_bound(r={:?}={})" , r , self . region_value_str( r) ) ;
1083
+ debug ! ( r = % self . region_value_str( r) ) ;
1096
1084
1097
1085
// Find the smallest universal region that contains all other
1098
1086
// universal regions within `region`.
@@ -1102,7 +1090,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1102
1090
lub = self . universal_region_relations . postdom_upper_bound ( lub, ur) ;
1103
1091
}
1104
1092
1105
- debug ! ( "universal_upper_bound: r={:?} lub={:?}" , r , lub) ;
1093
+ debug ! ( ? lub) ;
1106
1094
1107
1095
lub
1108
1096
}
@@ -1262,9 +1250,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1262
1250
}
1263
1251
1264
1252
// Evaluate whether `sup_region: sub_region`.
1253
+ #[ instrument( skip( self ) , level = "debug" ) ]
1265
1254
fn eval_outlives ( & self , sup_region : RegionVid , sub_region : RegionVid ) -> bool {
1266
- debug ! ( "eval_outlives({:?}: {:?})" , sup_region, sub_region) ;
1267
-
1268
1255
debug ! (
1269
1256
"eval_outlives: sup_region's value = {:?} universal={:?}" ,
1270
1257
self . region_value_str( sup_region) ,
@@ -1467,15 +1454,17 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1467
1454
///
1468
1455
/// Things that are to be propagated are accumulated into the
1469
1456
/// `outlives_requirements` vector.
1457
+ #[ instrument(
1458
+ skip( self , body, propagated_outlives_requirements, errors_buffer) ,
1459
+ level = "debug"
1460
+ ) ]
1470
1461
fn check_universal_region (
1471
1462
& self ,
1472
1463
body : & Body < ' tcx > ,
1473
1464
longer_fr : RegionVid ,
1474
1465
propagated_outlives_requirements : & mut Option < & mut Vec < ClosureOutlivesRequirement < ' tcx > > > ,
1475
1466
errors_buffer : & mut RegionErrors < ' tcx > ,
1476
1467
) {
1477
- debug ! ( "check_universal_region(fr={:?})" , longer_fr) ;
1478
-
1479
1468
let longer_fr_scc = self . constraint_sccs . scc ( longer_fr) ;
1480
1469
1481
1470
// Because this free region must be in the ROOT universe, we
@@ -1880,21 +1869,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1880
1869
}
1881
1870
1882
1871
/// Finds some region R such that `fr1: R` and `R` is live at `elem`.
1872
+ #[ instrument( skip( self ) , level = "trace" ) ]
1883
1873
crate fn find_sub_region_live_at ( & self , fr1 : RegionVid , elem : Location ) -> RegionVid {
1884
- debug ! ( "find_sub_region_live_at(fr1={:?}, elem={:?})" , fr1, elem) ;
1885
- debug ! ( "find_sub_region_live_at: {:?} is in scc {:?}" , fr1, self . constraint_sccs. scc( fr1) ) ;
1886
- debug ! (
1887
- "find_sub_region_live_at: {:?} is in universe {:?}" ,
1888
- fr1,
1889
- self . scc_universes[ self . constraint_sccs. scc( fr1) ]
1890
- ) ;
1874
+ trace ! ( scc = ?self . constraint_sccs. scc( fr1) ) ;
1875
+ trace ! ( universe = ?self . scc_universes[ self . constraint_sccs. scc( fr1) ] ) ;
1891
1876
self . find_constraint_paths_between_regions ( fr1, |r| {
1892
1877
// First look for some `r` such that `fr1: r` and `r` is live at `elem`
1893
- debug ! (
1894
- "find_sub_region_live_at: liveness_constraints for {:?} are {:?}" ,
1895
- r,
1896
- self . liveness_constraints. region_value_str( r) ,
1897
- ) ;
1878
+ trace ! ( ?r, liveness_constraints=?self . liveness_constraints. region_value_str( r) ) ;
1898
1879
self . liveness_constraints . contains ( r, elem)
1899
1880
} )
1900
1881
. or_else ( || {
0 commit comments