@@ -654,6 +654,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
654
654
/// scope for the bindings in these patterns, if such a scope had to be
655
655
/// created. NOTE: Declaring the bindings should always be done in their
656
656
/// drop scope.
657
+ #[ instrument( skip( self ) , level = "debug" ) ]
657
658
pub ( crate ) fn declare_bindings (
658
659
& mut self ,
659
660
mut visibility_scope : Option < SourceScope > ,
@@ -662,7 +663,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
662
663
has_guard : ArmHasGuard ,
663
664
opt_match_place : Option < ( Option < & Place < ' tcx > > , Span ) > ,
664
665
) -> Option < SourceScope > {
665
- debug ! ( "declare_bindings: pattern={:?}" , pattern) ;
666
666
self . visit_primary_bindings (
667
667
& pattern,
668
668
UserTypeProjections :: none ( ) ,
@@ -1048,6 +1048,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1048
1048
/// if `x.0` matches `false` (for the third arm). In the (impossible at
1049
1049
/// runtime) case when `x.0` is now `true`, we branch to
1050
1050
/// `otherwise_block`.
1051
+ #[ instrument( skip( self , fake_borrows) , level = "debug" ) ]
1051
1052
fn match_candidates < ' pat > (
1052
1053
& mut self ,
1053
1054
span : Span ,
@@ -1057,11 +1058,6 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1057
1058
candidates : & mut [ & mut Candidate < ' pat , ' tcx > ] ,
1058
1059
fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1059
1060
) {
1060
- debug ! (
1061
- "matched_candidate(span={:?}, candidates={:?}, start_block={:?}, otherwise_block={:?})" ,
1062
- span, candidates, start_block, otherwise_block,
1063
- ) ;
1064
-
1065
1061
// Start by simplifying candidates. Once this process is complete, all
1066
1062
// the match pairs which remain require some form of test, whether it
1067
1063
// be a switch or pattern comparison.
@@ -1380,6 +1376,10 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1380
1376
)
1381
1377
}
1382
1378
1379
+ #[ instrument(
1380
+ skip( self , otherwise, or_span, place, fake_borrows, candidate, pats) ,
1381
+ level = "debug"
1382
+ ) ]
1383
1383
fn test_or_pattern < ' pat > (
1384
1384
& mut self ,
1385
1385
candidate : & mut Candidate < ' pat , ' tcx > ,
@@ -1389,7 +1389,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1389
1389
place : PlaceBuilder < ' tcx > ,
1390
1390
fake_borrows : & mut Option < FxIndexSet < Place < ' tcx > > > ,
1391
1391
) {
1392
- debug ! ( "test_or_pattern: \n candidate ={:#?}\n pats={:#?}" , candidate, pats) ;
1392
+ debug ! ( "candidate ={:#?}\n pats={:#?}" , candidate, pats) ;
1393
1393
let mut or_candidates: Vec < _ > = pats
1394
1394
. iter ( )
1395
1395
. map ( |pat| Candidate :: new ( place. clone ( ) , pat, candidate. has_guard ) )
@@ -1634,9 +1634,14 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
1634
1634
candidates = rest;
1635
1635
}
1636
1636
// 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( ) ) ;
1640
1645
1641
1646
// HACK(matthewjasper) This is a closure so that we can let the test
1642
1647
// create its blocks before the rest of the match. This currently
@@ -2195,6 +2200,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2195
2200
/// first local is a binding for occurrences of `var` in the guard, which
2196
2201
/// will have type `&T`. The second local is a binding for occurrences of
2197
2202
/// `var` in the arm body, which will have type `T`.
2203
+ #[ instrument( skip( self ) , level = "debug" ) ]
2198
2204
fn declare_binding (
2199
2205
& mut self ,
2200
2206
source_info : SourceInfo ,
@@ -2209,19 +2215,12 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2209
2215
opt_match_place : Option < ( Option < Place < ' tcx > > , Span ) > ,
2210
2216
pat_span : Span ,
2211
2217
) {
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
-
2218
2218
let tcx = self . tcx ;
2219
2219
let debug_source_info = SourceInfo { span : source_info. span , scope : visibility_scope } ;
2220
2220
let binding_mode = match mode {
2221
2221
BindingMode :: ByValue => ty:: BindingMode :: BindByValue ( mutability) ,
2222
2222
BindingMode :: ByRef ( _) => ty:: BindingMode :: BindByReference ( mutability) ,
2223
2223
} ;
2224
- debug ! ( "declare_binding: user_ty={:?}" , user_ty) ;
2225
2224
let local = LocalDecl :: < ' tcx > {
2226
2225
mutability,
2227
2226
ty : var_ty,
@@ -2271,7 +2270,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
2271
2270
} else {
2272
2271
LocalsForNode :: One ( for_arm_body)
2273
2272
} ;
2274
- debug ! ( "declare_binding: vars={:?}" , locals) ;
2273
+ debug ! ( ? locals) ;
2275
2274
self . var_indices . insert ( var_id, locals) ;
2276
2275
}
2277
2276
0 commit comments