37
37
#![ recursion_limit = "256" ]
38
38
#![ allow( rustc:: potential_query_instability) ]
39
39
40
+ #[ macro_use]
41
+ extern crate tracing;
42
+
40
43
use rustc_ast:: visit;
41
44
use rustc_ast:: { self as ast, * } ;
42
45
use rustc_ast_pretty:: pprust;
@@ -63,7 +66,6 @@ use rustc_span::{Span, DUMMY_SP};
63
66
64
67
use smallvec:: SmallVec ;
65
68
use std:: collections:: hash_map:: Entry ;
66
- use tracing:: { debug, trace} ;
67
69
68
70
macro_rules! arena_vec {
69
71
( $this: expr; $( $x: expr) ,* ) => (
@@ -439,7 +441,7 @@ pub fn lower_crate<'a, 'hir>(
439
441
arena. alloc ( krate)
440
442
}
441
443
442
- #[ derive( Copy , Clone , PartialEq ) ]
444
+ #[ derive( Copy , Clone , PartialEq , Debug ) ]
443
445
enum ParamMode {
444
446
/// Any path in a type context.
445
447
Explicit ,
@@ -455,6 +457,7 @@ enum ParenthesizedGenericArgs {
455
457
}
456
458
457
459
impl < ' a , ' hir > LoweringContext < ' a , ' hir > {
460
+ #[ instrument( level = "debug" , skip( self , f) ) ]
458
461
fn with_hir_id_owner (
459
462
& mut self ,
460
463
owner : NodeId ,
@@ -599,12 +602,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
599
602
self . lower_node_id ( node_id)
600
603
}
601
604
605
+ #[ instrument( level = "trace" , skip( self ) ) ]
602
606
fn lower_res ( & mut self , res : Res < NodeId > ) -> Res {
603
607
let res: Result < Res , ( ) > = res. apply_id ( |id| {
604
608
let owner = self . current_hir_id_owner ;
605
609
let local_id = self . node_id_to_local_id . get ( & id) . copied ( ) . ok_or ( ( ) ) ?;
606
610
Ok ( hir:: HirId { owner, local_id } )
607
611
} ) ;
612
+ trace ! ( ?res) ;
613
+
608
614
// We may fail to find a HirId when the Res points to a Local from an enclosing HIR owner.
609
615
// This can happen when trying to lower the return type `x` in erroneous code like
610
616
// async fn foo(x: u8) -> x {}
@@ -851,6 +857,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
851
857
/// ```
852
858
///
853
859
/// returns a `hir::TypeBinding` representing `Item`.
860
+ #[ instrument( level = "debug" , skip( self ) ) ]
854
861
fn lower_assoc_ty_constraint (
855
862
& mut self ,
856
863
constraint : & AssocConstraint ,
@@ -1011,6 +1018,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1011
1018
err. emit ( ) ;
1012
1019
}
1013
1020
1021
+ #[ instrument( level = "debug" , skip( self ) ) ]
1014
1022
fn lower_generic_arg (
1015
1023
& mut self ,
1016
1024
arg : & ast:: GenericArg ,
@@ -1081,6 +1089,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1081
1089
}
1082
1090
}
1083
1091
1092
+ #[ instrument( level = "debug" , skip( self ) ) ]
1084
1093
fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> & ' hir hir:: Ty < ' hir > {
1085
1094
self . arena . alloc ( self . lower_ty_direct ( t, itctx) )
1086
1095
}
@@ -1737,6 +1746,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1737
1746
)
1738
1747
}
1739
1748
1749
+ #[ instrument( level = "trace" , skip( self ) ) ]
1740
1750
fn lower_param_bound (
1741
1751
& mut self ,
1742
1752
tpb : & GenericBound ,
@@ -1862,6 +1872,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
1862
1872
self . arena . alloc_from_iter ( self . lower_generic_params_mut ( params) )
1863
1873
}
1864
1874
1875
+ #[ instrument( level = "trace" , skip( self ) ) ]
1865
1876
fn lower_generic_param ( & mut self , param : & GenericParam ) -> hir:: GenericParam < ' hir > {
1866
1877
let ( name, kind) = match param. kind {
1867
1878
GenericParamKind :: Lifetime => {
0 commit comments