@@ -80,6 +80,10 @@ macro_rules! erase {
80
80
( $x: tt) => ( { } )
81
81
}
82
82
83
+ macro_rules! replace {
84
+ ( $x: tt with $( $y: tt) * ) => ( $( $y) * )
85
+ }
86
+
83
87
macro_rules! is_anon_attr {
84
88
( anon) => ( true ) ;
85
89
( $attr: ident) => ( false ) ;
@@ -111,7 +115,7 @@ macro_rules! define_dep_nodes {
111
115
( <$tcx: tt>
112
116
$(
113
117
[ $( $attr: ident) ,* ]
114
- $variant: ident $( ( $( $tuple_arg : tt ) , * ) ) *
118
+ $variant: ident $( ( $tuple_arg_ty : ty $ ( , ) * ) ) *
115
119
$( { $( $struct_arg_name: ident : $struct_arg_ty: ty) ,* } ) *
116
120
, ) *
117
121
) => (
@@ -134,7 +138,7 @@ macro_rules! define_dep_nodes {
134
138
135
139
// tuple args
136
140
$( {
137
- return <( $ ( $tuple_arg , ) * ) as DepNodeParams >
141
+ return <$tuple_arg_ty as DepNodeParams >
138
142
:: CAN_RECONSTRUCT_QUERY_KEY ;
139
143
} ) *
140
144
@@ -186,7 +190,7 @@ macro_rules! define_dep_nodes {
186
190
DepKind :: $variant => {
187
191
// tuple args
188
192
$( {
189
- $ ( erase!( $tuple_arg ) ; ) *
193
+ erase!( $tuple_arg_ty ) ;
190
194
return true ;
191
195
} ) *
192
196
@@ -205,7 +209,7 @@ macro_rules! define_dep_nodes {
205
209
206
210
pub enum DepConstructor <$tcx> {
207
211
$(
208
- $variant $( ( $( $tuple_arg ) , * ) ) *
212
+ $variant $( ( $tuple_arg_ty ) ) *
209
213
$( { $( $struct_arg_name : $struct_arg_ty) ,* } ) *
210
214
) ,*
211
215
}
@@ -227,15 +231,14 @@ macro_rules! define_dep_nodes {
227
231
{
228
232
match dep {
229
233
$(
230
- DepConstructor :: $variant $( ( $ ( $tuple_arg ) , * ) ) *
234
+ DepConstructor :: $variant $( ( replace! ( ( $tuple_arg_ty ) with arg ) ) ) *
231
235
$( { $( $struct_arg_name) ,* } ) *
232
236
=>
233
237
{
234
238
// tuple args
235
239
$( {
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) ;
239
242
let dep_node = DepNode {
240
243
kind: DepKind :: $variant,
241
244
hash
@@ -247,7 +250,7 @@ macro_rules! define_dep_nodes {
247
250
tcx. sess. opts. debugging_opts. query_dep_graph)
248
251
{
249
252
tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
250
- tupled_args . to_debug_str( tcx)
253
+ arg . to_debug_str( tcx)
251
254
} ) ;
252
255
}
253
256
@@ -679,43 +682,43 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a, T> DepNodeParams<'a, 'gcx, 'tcx> for T
679
682
}
680
683
}
681
684
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 {
683
686
const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
684
687
685
688
fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
686
- tcx. def_path_hash ( self . 0 ) . 0
689
+ tcx. def_path_hash ( * self ) . 0
687
690
}
688
691
689
692
fn to_debug_str ( & self , tcx : TyCtxt < ' a , ' gcx , ' tcx > ) -> String {
690
- tcx. item_path_str ( self . 0 )
693
+ tcx. item_path_str ( * self )
691
694
}
692
695
}
693
696
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 {
695
698
const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
696
699
697
700
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
699
702
}
700
703
701
704
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 ) )
703
706
}
704
707
}
705
708
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 {
707
710
const CAN_RECONSTRUCT_QUERY_KEY : bool = true ;
708
711
709
712
fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
710
713
let def_id = DefId {
711
- krate : self . 0 ,
714
+ krate : * self ,
712
715
index : CRATE_DEF_INDEX ,
713
716
} ;
714
717
tcx. def_path_hash ( def_id) . 0
715
718
}
716
719
717
720
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 ( )
719
722
}
720
723
}
721
724
@@ -743,17 +746,17 @@ impl<'a, 'gcx: 'tcx + 'a, 'tcx: 'a> DepNodeParams<'a, 'gcx, 'tcx> for (DefId, De
743
746
}
744
747
}
745
748
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 {
747
750
const CAN_RECONSTRUCT_QUERY_KEY : bool = false ;
748
751
749
752
// We actually would not need to specialize the implementation of this
750
753
// method but it's faster to combine the hashes than to instantiate a full
751
754
// hashing context and stable-hashing state.
752
755
fn to_fingerprint ( & self , tcx : TyCtxt ) -> Fingerprint {
753
- let ( HirId {
756
+ let HirId {
754
757
owner,
755
758
local_id : ItemLocalId ( local_id) ,
756
- } , ) = * self ;
759
+ } = * self ;
757
760
758
761
let def_path_hash = tcx. def_path_hash ( DefId :: local ( owner) ) ;
759
762
let local_id = Fingerprint :: from_smaller_hash ( local_id as u64 ) ;
0 commit comments