@@ -80,6 +80,10 @@ macro_rules! erase {
8080 ( $x: tt) => ( { } )
8181}
8282
83+ macro_rules! replace {
84+ ( $x: tt with $( $y: tt) * ) => ( $( $y) * )
85+ }
86+
8387macro_rules! is_anon_attr {
8488 ( anon) => ( true ) ;
8589 ( $attr: ident) => ( false ) ;
@@ -111,7 +115,7 @@ macro_rules! define_dep_nodes {
111115 ( <$tcx: tt>
112116 $(
113117 [ $( $attr: ident) ,* ]
114- $variant: ident $( ( $( $tuple_arg : tt ) , * ) ) *
118+ $variant: ident $( ( $tuple_arg_ty : ty $ ( , ) * ) ) *
115119 $( { $( $struct_arg_name: ident : $struct_arg_ty: ty) ,* } ) *
116120 , ) *
117121 ) => (
@@ -134,7 +138,7 @@ macro_rules! define_dep_nodes {
134138
135139 // tuple args
136140 $( {
137- return <( $ ( $tuple_arg , ) * ) as DepNodeParams >
141+ return <$tuple_arg_ty as DepNodeParams >
138142 :: CAN_RECONSTRUCT_QUERY_KEY ;
139143 } ) *
140144
@@ -186,7 +190,7 @@ macro_rules! define_dep_nodes {
186190 DepKind :: $variant => {
187191 // tuple args
188192 $( {
189- $ ( erase!( $tuple_arg ) ; ) *
193+ erase!( $tuple_arg_ty ) ;
190194 return true ;
191195 } ) *
192196
@@ -205,7 +209,7 @@ macro_rules! define_dep_nodes {
205209
206210 pub enum DepConstructor <$tcx> {
207211 $(
208- $variant $( ( $( $tuple_arg ) , * ) ) *
212+ $variant $( ( $tuple_arg_ty ) ) *
209213 $( { $( $struct_arg_name : $struct_arg_ty) ,* } ) *
210214 ) ,*
211215 }
@@ -227,15 +231,14 @@ macro_rules! define_dep_nodes {
227231 {
228232 match dep {
229233 $(
230- DepConstructor :: $variant $( ( $ ( $tuple_arg ) , * ) ) *
234+ DepConstructor :: $variant $( ( replace! ( ( $tuple_arg_ty ) with arg ) ) ) *
231235 $( { $( $struct_arg_name) ,* } ) *
232236 =>
233237 {
234238 // tuple args
235239 $( {
236- let tupled_args = ( $( $tuple_arg, ) * ) ;
237- let hash = DepNodeParams :: to_fingerprint( & tupled_args,
238- tcx) ;
240+ erase!( $tuple_arg_ty) ;
241+ let hash = DepNodeParams :: to_fingerprint( & arg, tcx) ;
239242 let dep_node = DepNode {
240243 kind: DepKind :: $variant,
241244 hash
@@ -247,7 +250,7 @@ macro_rules! define_dep_nodes {
247250 tcx. sess. opts. debugging_opts. query_dep_graph)
248251 {
249252 tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
250- tupled_args . to_debug_str( tcx)
253+ arg . to_debug_str( tcx)
251254 } ) ;
252255 }
253256
@@ -679,43 +682,43 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T
679682 }
680683}
681684
682- impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for ( DefId , ) {
685+ impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for DefId {
683686 const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
684687
685688 fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
686- tcx. def_path_hash ( self . 0 ) . 0
689+ tcx. def_path_hash ( * self ) . 0
687690 }
688691
689692 fn to_debug_str ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> String {
690- tcx. item_path_str ( self . 0 )
693+ tcx. item_path_str ( * self )
691694 }
692695}
693696
694- impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for ( DefIndex , ) {
697+ impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for DefIndex {
695698 const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
696699
697700 fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
698- tcx. hir . definitions ( ) . def_path_hash ( self . 0 ) . 0
701+ tcx. hir . definitions ( ) . def_path_hash ( * self ) . 0
699702 }
700703
701704 fn to_debug_str ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> String {
702- tcx. item_path_str ( DefId :: local ( self . 0 ) )
705+ tcx. item_path_str ( DefId :: local ( * self ) )
703706 }
704707}
705708
706- impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for ( CrateNum , ) {
709+ impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for CrateNum {
707710 const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
708711
709712 fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
710713 let def_id = DefId {
711- krate : self . 0 ,
714+ krate : * self ,
712715 index : CRATE_DEF_INDEX ,
713716 } ;
714717 tcx. def_path_hash ( def_id) . 0
715718 }
716719
717720 fn to_debug_str ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> String {
718- tcx. crate_name ( self . 0 ) . as_str ( ) . to_string ( )
721+ tcx. crate_name ( * self ) . as_str ( ) . to_string ( )
719722 }
720723}
721724
@@ -743,17 +746,17 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
743746 }
744747}
745748
746- impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for ( HirId , ) {
749+ impl < ' a , ' gcx : ' tcx + ' a , ' tcx : ' a > DepNodeParams < ' a , ' gcx , ' tcx > for HirId {
747750 const CAN_RECONSTRUCT_QUERY_KEY : bool = false ;
748751
749752 // We actually would not need to specialize the implementation of this
750753 // method but it's faster to combine the hashes than to instantiate a full
751754 // hashing context and stable-hashing state.
752755 fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
753- let ( HirId {
756+ let HirId {
754757 owner,
755758 local_id : ItemLocalId ( local_id) ,
756- } , ) = * self ;
759+ } = * self ;
757760
758761 let def_path_hash = tcx. def_path_hash ( DefId :: local ( owner) ) ;
759762 let local_id = Fingerprint :: from_smaller_hash ( local_id as u64 ) ;
0 commit comments