3737#![ recursion_limit = "256" ]
3838#![ allow( rustc:: potential_query_instability) ]
3939
40+ #[ macro_use]
41+ extern crate tracing;
42+
4043use rustc_ast:: visit;
4144use rustc_ast:: { self as ast, * } ;
4245use rustc_ast_pretty:: pprust;
@@ -63,7 +66,6 @@ use rustc_span::{Span, DUMMY_SP};
6366
6467use smallvec:: SmallVec ;
6568use std:: collections:: hash_map:: Entry ;
66- use tracing:: { debug, trace} ;
6769
6870macro_rules! arena_vec {
6971 ( $this: expr; $( $x: expr) ,* ) => (
@@ -439,7 +441,7 @@ pub fn lower_crate<'a, 'hir>(
439441 arena. alloc ( krate)
440442}
441443
442- #[ derive( Copy , Clone , PartialEq ) ]
444+ #[ derive( Copy , Clone , PartialEq , Debug ) ]
443445enum ParamMode {
444446 /// Any path in a type context.
445447 Explicit ,
@@ -455,6 +457,7 @@ enum ParenthesizedGenericArgs {
455457}
456458
457459impl < ' a , ' hir > LoweringContext < ' a , ' hir > {
460+ #[ instrument( level = "debug" , skip( self , f) ) ]
458461 fn with_hir_id_owner (
459462 & mut self ,
460463 owner : NodeId ,
@@ -599,12 +602,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
599602 self . lower_node_id ( node_id)
600603 }
601604
605+ #[ instrument( level = "trace" , skip( self ) ) ]
602606 fn lower_res ( & mut self , res : Res < NodeId > ) -> Res {
603607 let res: Result < Res , ( ) > = res. apply_id ( |id| {
604608 let owner = self . current_hir_id_owner ;
605609 let local_id = self . node_id_to_local_id . get ( & id) . copied ( ) . ok_or ( ( ) ) ?;
606610 Ok ( hir:: HirId { owner, local_id } )
607611 } ) ;
612+ trace ! ( ?res) ;
613+
608614 // We may fail to find a HirId when the Res points to a Local from an enclosing HIR owner.
609615 // This can happen when trying to lower the return type `x` in erroneous code like
610616 // async fn foo(x: u8) -> x {}
@@ -851,6 +857,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
851857 /// ```
852858 ///
853859 /// returns a `hir::TypeBinding` representing `Item`.
860+ #[ instrument( level = "debug" , skip( self ) ) ]
854861 fn lower_assoc_ty_constraint (
855862 & mut self ,
856863 constraint : & AssocConstraint ,
@@ -1011,6 +1018,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10111018 err. emit ( ) ;
10121019 }
10131020
1021+ #[ instrument( level = "debug" , skip( self ) ) ]
10141022 fn lower_generic_arg (
10151023 & mut self ,
10161024 arg : & ast:: GenericArg ,
@@ -1081,6 +1089,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10811089 }
10821090 }
10831091
1092+ #[ instrument( level = "debug" , skip( self ) ) ]
10841093 fn lower_ty ( & mut self , t : & Ty , itctx : ImplTraitContext ) -> & ' hir hir:: Ty < ' hir > {
10851094 self . arena . alloc ( self . lower_ty_direct ( t, itctx) )
10861095 }
@@ -1737,6 +1746,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17371746 )
17381747 }
17391748
1749+ #[ instrument( level = "trace" , skip( self ) ) ]
17401750 fn lower_param_bound (
17411751 & mut self ,
17421752 tpb : & GenericBound ,
@@ -1862,6 +1872,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18621872 self . arena . alloc_from_iter ( self . lower_generic_params_mut ( params) )
18631873 }
18641874
1875+ #[ instrument( level = "trace" , skip( self ) ) ]
18651876 fn lower_generic_param ( & mut self , param : & GenericParam ) -> hir:: GenericParam < ' hir > {
18661877 let ( name, kind) = match param. kind {
18671878 GenericParamKind :: Lifetime => {
0 commit comments