@@ -654,6 +654,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
654654 /// scope for the bindings in these patterns, if such a scope had to be
655655 /// created. NOTE: Declaring the bindings should always be done in their
656656 /// drop scope.
657+ #[ instrument( skip( self ) , level = "debug" ) ]
657658 pub ( crate ) fn declare_bindings (
658659 & mut self ,
659660 mut visibility_scope : Option < SourceScope > ,
@@ -662,7 +663,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
662663 has_guard : ArmHasGuard ,
663664 opt_match_place : Option < ( Option < & Place < ' tcx > > , Span ) > ,
664665 ) -> Option < SourceScope > {
665- debug ! ( "declare_bindings: pattern={:?}" , pattern) ;
666666 self . visit_primary_bindings (
667667 & pattern,
668668 UserTypeProjections :: none ( ) ,
@@ -1048,6 +1048,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
10481048 /// if `x.0` matches `false` (for the third arm). In the (impossible at
10491049 /// runtime) case when `x.0` is now `true`, we branch to
10501050 /// `otherwise_block`.
1051+ #[ instrument( skip( self , fake_borrows) , level = "debug" ) ]
10511052 fn match_candidates < ' pat > (
10521053 & mut self ,
10531054 span : Span ,
@@ -1057,11 +1058,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
10571058 candidates : & mut [ & mut Candidate < ' pat , ' tcx > ] ,
10581059 fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
10591060 ) {
1060- debug ! (
1061- "matched_candidate(span={:?}, candidates={:?}, start_block={:?}, otherwise_block={:?})" ,
1062- span, candidates, start_block, otherwise_block,
1063- ) ;
1064-
10651061 // Start by simplifying candidates. Once this process is complete, all
10661062 // the match pairs which remain require some form of test, whether it
10671063 // be a switch or pattern comparison.
@@ -1380,6 +1376,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13801376 )
13811377 }
13821378
1379+ #[ instrument(
1380+ skip( self , otherwise, or_span, place, fake_borrows, candidate, pats) ,
1381+ level = "debug"
1382+ ) ]
13831383 fn test_or_pattern < ' pat > (
13841384 & mut self ,
13851385 candidate : & mut Candidate < ' pat , ' tcx > ,
@@ -1389,7 +1389,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
13891389 place : PlaceBuilder < ' tcx > ,
13901390 fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
13911391 ) {
1392- debug ! ( "test_or_pattern: \n candidate ={:#?}\n pats={:#?}" , candidate, pats) ;
1392+ debug ! ( "candidate ={:#?}\n pats={:#?}" , candidate, pats) ;
13931393 let mut or_candidates: Vec < _ > = pats
13941394 . iter ( )
13951395 . map ( |pat| Candidate :: new ( place. clone ( ) , pat, candidate. has_guard ) )
@@ -1634,9 +1634,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
16341634 candidates = rest;
16351635 }
16361636 // at least the first candidate ought to be tested
1637- assert ! ( total_candidate_count > candidates. len( ) ) ;
1638- debug ! ( "test_candidates: tested_candidates: {}" , total_candidate_count - candidates. len( ) ) ;
1639- debug ! ( "test_candidates: untested_candidates: {}" , candidates. len( ) ) ;
1637+ assert ! (
1638+ total_candidate_count > candidates. len( ) ,
1639+ "{}, {:#?}" ,
1640+ total_candidate_count,
1641+ candidates
1642+ ) ;
1643+ debug ! ( "tested_candidates: {}" , total_candidate_count - candidates. len( ) ) ;
1644+ debug ! ( "untested_candidates: {}" , candidates. len( ) ) ;
16401645
16411646 // HACK(matthewjasper) This is a closure so that we can let the test
16421647 // create its blocks before the rest of the match. This currently
@@ -2195,6 +2200,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
21952200 /// first local is a binding for occurrences of `var` in the guard, which
21962201 /// will have type `&T`. The second local is a binding for occurrences of
21972202 /// `var` in the arm body, which will have type `T`.
2203+ #[ instrument( skip( self ) , level = "debug" ) ]
21982204 fn declare_binding (
21992205 & mut self ,
22002206 source_info : SourceInfo ,
@@ -2209,19 +2215,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
22092215 opt_match_place : Option < ( Option < Place < ' tcx > > , Span ) > ,
22102216 pat_span : Span ,
22112217 ) {
2212- debug ! (
2213- "declare_binding(var_id={:?}, name={:?}, mode={:?}, var_ty={:?}, \
2214- visibility_scope={:?}, source_info={:?})",
2215- var_id, name, mode, var_ty, visibility_scope, source_info
2216- ) ;
2217-
22182218 let tcx = self . tcx ;
22192219 let debug_source_info = SourceInfo { span : source_info. span , scope : visibility_scope } ;
22202220 let binding_mode = match mode {
22212221 BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability) ,
22222222 BindingMode :: ByRef ( _) => ty:: BindingMode :: BindByReference ( mutability) ,
22232223 } ;
2224- debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
22252224 let local = LocalDecl :: < ' tcx > {
22262225 mutability,
22272226 ty : var_ty,
@@ -2271,7 +2270,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
22712270 } else {
22722271 LocalsForNode :: One ( for_arm_body)
22732272 } ;
2274- debug ! ( "declare_binding: vars={:?}" , locals) ;
2273+ debug ! ( ? locals) ;
22752274 self . var_indices . insert ( var_id, locals) ;
22762275 }
22772276
0 commit comments