@@ -552,6 +552,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
552552 /// Performs region inference and report errors if we see any
553553 /// unsatisfiable constraints. If this is a closure, returns the
554554 /// region requirements to propagate to our creator, if any.
555+ #[ instrument( skip( self , infcx, body, polonius_output) , level = "debug" ) ]
555556 pub ( super ) fn solve (
556557 & mut self ,
557558 infcx : & InferCtxt < ' _ , ' tcx > ,
@@ -607,10 +608,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
607608 /// for each region variable until all the constraints are
608609 /// satisfied. Note that some values may grow **too** large to be
609610 /// feasible, but we check this later.
611+ #[ instrument( skip( self , _body) , level = "debug" ) ]
610612 fn propagate_constraints ( & mut self , _body : & Body < ' tcx > ) {
611- debug ! ( "propagate_constraints()" ) ;
612-
613- debug ! ( "propagate_constraints: constraints={:#?}" , {
613+ debug ! ( "constraints={:#?}" , {
614614 let mut constraints: Vec <_> = self . constraints. outlives( ) . iter( ) . collect( ) ;
615615 constraints. sort( ) ;
616616 constraints
@@ -637,12 +637,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
637637 /// computed, by unioning the values of its successors.
638638 /// Assumes that all successors have been computed already
639639 /// (which is assured by iterating over SCCs in dependency order).
640+ #[ instrument( skip( self ) , level = "debug" ) ]
640641 fn compute_value_for_scc ( & mut self , scc_a : ConstraintSccIndex ) {
641642 let constraint_sccs = self . constraint_sccs . clone ( ) ;
642643
643644 // Walk each SCC `B` such that `A: B`...
644645 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) ;
646647
647648 // ...and add elements from `B` into `A`. One complication
648649 // arises because of universes: If `B` contains something
@@ -663,11 +664,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
663664 self . apply_member_constraint ( scc_a, m_c_i, member_constraints. choice_regions ( m_c_i) ) ;
664665 }
665666
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) ) ;
671668 }
672669
673670 /// Invoked for each `R0 member of [R1..Rn]` constraint.
@@ -681,14 +678,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
681678 /// is considered a *lower bound*. If possible, we will modify
682679 /// the constraint to set it equal to one of the option regions.
683680 /// If we make any changes, returns true, else false.
681+ #[ instrument( skip( self , member_constraint_index) , level = "debug" ) ]
684682 fn apply_member_constraint (
685683 & mut self ,
686684 scc : ConstraintSccIndex ,
687685 member_constraint_index : NllMemberConstraintIndex ,
688686 choice_regions : & [ ty:: RegionVid ] ,
689687 ) -> bool {
690- debug ! ( "apply_member_constraint(scc={:?}, choice_regions={:#?})" , scc, choice_regions, ) ;
691-
692688 // Create a mutable vector of the options. We'll try to winnow
693689 // them down.
694690 let mut choice_regions: Vec < ty:: RegionVid > = choice_regions. to_vec ( ) ;
@@ -714,7 +710,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
714710 . universal_regions_outlived_by ( scc)
715711 . all ( |lb| self . universal_region_relations . outlives ( o_r, lb) )
716712 } ) ;
717- debug ! ( "apply_member_constraint: after lb, choice_regions={:?}" , choice_regions ) ;
713+ debug ! ( ?choice_regions , " after lb" ) ;
718714
719715 // Now find all the *upper bounds* -- that is, each UB is a
720716 // free region that must outlive the member region `R0` (`UB:
@@ -723,10 +719,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
723719 let rev_scc_graph = self . reverse_scc_graph ( ) ;
724720 let universal_region_relations = & self . universal_region_relations ;
725721 for ub in rev_scc_graph. upper_bounds ( scc) {
726- debug ! ( "apply_member_constraint: ub={:?}" , ub) ;
722+ debug ! ( ? ub) ;
727723 choice_regions. retain ( |& o_r| universal_region_relations. outlives ( ub, o_r) ) ;
728724 }
729- debug ! ( "apply_member_constraint: after ub, choice_regions={:?}" , choice_regions ) ;
725+ debug ! ( ?choice_regions , " after ub" ) ;
730726
731727 // If we ruled everything out, we're done.
732728 if choice_regions. is_empty ( ) {
@@ -735,7 +731,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
735731
736732 // Otherwise, we need to find the minimum remaining choice, if
737733 // any, and take that.
738- debug ! ( "apply_member_constraint: choice_regions remaining are {:#?}" , choice_regions) ;
734+ debug ! ( "choice_regions remaining are {:#?}" , choice_regions) ;
739735 let min = |r1 : ty:: RegionVid , r2 : ty:: RegionVid | -> Option < ty:: RegionVid > {
740736 let r1_outlives_r2 = self . universal_region_relations . outlives ( r1, r2) ;
741737 let r2_outlives_r1 = self . universal_region_relations . outlives ( r2, r1) ;
@@ -748,27 +744,18 @@ impl<'tcx> RegionInferenceContext<'tcx> {
748744 } ;
749745 let mut min_choice = choice_regions[ 0 ] ;
750746 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, ) ;
755748 match min ( min_choice, other_option) {
756749 Some ( m) => min_choice = m,
757750 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" , ) ;
762752 return false ;
763753 }
764754 }
765755 }
766756
767757 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) ;
772759 if self . scc_values . add_region ( scc, min_choice_scc) {
773760 self . member_constraints_applied . push ( AppliedMemberConstraint {
774761 member_region_scc : scc,
@@ -1091,8 +1078,9 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10911078 /// include the CFG anyhow.
10921079 /// - For each `end('x)` element in `'r`, compute the mutual LUB, yielding
10931080 /// a result `'y`.
1081+ #[ instrument( skip( self ) , level = "debug" ) ]
10941082 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) ) ;
10961084
10971085 // Find the smallest universal region that contains all other
10981086 // universal regions within `region`.
@@ -1102,7 +1090,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
11021090 lub = self . universal_region_relations . postdom_upper_bound ( lub, ur) ;
11031091 }
11041092
1105- debug ! ( "universal_upper_bound: r={:?} lub={:?}" , r , lub) ;
1093+ debug ! ( ? lub) ;
11061094
11071095 lub
11081096 }
@@ -1262,9 +1250,8 @@ impl<'tcx> RegionInferenceContext<'tcx> {
12621250 }
12631251
12641252 // Evaluate whether `sup_region: sub_region`.
1253+ #[ instrument( skip( self ) , level = "debug" ) ]
12651254 fn eval_outlives ( & self , sup_region : RegionVid , sub_region : RegionVid ) -> bool {
1266- debug ! ( "eval_outlives({:?}: {:?})" , sup_region, sub_region) ;
1267-
12681255 debug ! (
12691256 "eval_outlives: sup_region's value = {:?} universal={:?}" ,
12701257 self . region_value_str( sup_region) ,
@@ -1467,15 +1454,17 @@ impl<'tcx> RegionInferenceContext<'tcx> {
14671454 ///
14681455 /// Things that are to be propagated are accumulated into the
14691456 /// `outlives_requirements` vector.
1457+ #[ instrument(
1458+ skip( self , body, propagated_outlives_requirements, errors_buffer) ,
1459+ level = "debug"
1460+ ) ]
14701461 fn check_universal_region (
14711462 & self ,
14721463 body : & Body < ' tcx > ,
14731464 longer_fr : RegionVid ,
14741465 propagated_outlives_requirements : & mut Option < & mut Vec < ClosureOutlivesRequirement < ' tcx > > > ,
14751466 errors_buffer : & mut RegionErrors < ' tcx > ,
14761467 ) {
1477- debug ! ( "check_universal_region(fr={:?})" , longer_fr) ;
1478-
14791468 let longer_fr_scc = self . constraint_sccs . scc ( longer_fr) ;
14801469
14811470 // Because this free region must be in the ROOT universe, we
@@ -1880,21 +1869,13 @@ impl<'tcx> RegionInferenceContext<'tcx> {
18801869 }
18811870
18821871 /// Finds some region R such that `fr1: R` and `R` is live at `elem`.
1872+ #[ instrument( skip( self ) , level = "trace" ) ]
18831873 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) ] ) ;
18911876 self . find_constraint_paths_between_regions ( fr1, |r| {
18921877 // 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) ) ;
18981879 self . liveness_constraints . contains ( r, elem)
18991880 } )
19001881 . or_else ( || {
0 commit comments