@@ -76,10 +76,6 @@ macro_rules! erase {
76
76
( $x: tt) => { { } } ;
77
77
}
78
78
79
- macro_rules! replace {
80
- ( $x: tt with $( $y: tt) * ) => ( $( $y) * )
81
- }
82
-
83
79
macro_rules! is_anon_attr {
84
80
( anon) => {
85
81
true
@@ -175,10 +171,43 @@ macro_rules! define_dep_nodes {
175
171
}
176
172
}
177
173
178
- pub enum DepConstructor <$tcx> {
174
+ pub struct DepConstructor ;
175
+
176
+ impl DepConstructor {
179
177
$(
180
- $variant $( ( $tuple_arg_ty ) ) *
181
- ) ,*
178
+ #[ inline( always) ]
179
+ #[ allow( unreachable_code, non_snake_case) ]
180
+ pub fn $variant<' tcx>( _tcx: TyCtxt <' tcx>, $( arg: $tuple_arg_ty) * ) -> DepNode {
181
+ // tuple args
182
+ $( {
183
+ erase!( $tuple_arg_ty) ;
184
+ let hash = DepNodeParams :: to_fingerprint( & arg, _tcx) ;
185
+ let dep_node = DepNode {
186
+ kind: DepKind :: $variant,
187
+ hash
188
+ } ;
189
+
190
+ #[ cfg( debug_assertions) ]
191
+ {
192
+ if !dep_node. kind. can_reconstruct_query_key( ) &&
193
+ ( _tcx. sess. opts. debugging_opts. incremental_info ||
194
+ _tcx. sess. opts. debugging_opts. query_dep_graph)
195
+ {
196
+ _tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
197
+ arg. to_debug_str( _tcx)
198
+ } ) ;
199
+ }
200
+ }
201
+
202
+ return dep_node;
203
+ } ) *
204
+
205
+ DepNode {
206
+ kind: DepKind :: $variant,
207
+ hash: Fingerprint :: ZERO ,
208
+ }
209
+ }
210
+ ) *
182
211
}
183
212
184
213
#[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash ,
@@ -189,49 +218,6 @@ macro_rules! define_dep_nodes {
189
218
}
190
219
191
220
impl DepNode {
192
- #[ allow( unreachable_code, non_snake_case) ]
193
- pub fn new<' tcx>( tcx: TyCtxt <' tcx>,
194
- dep: DepConstructor <' tcx>)
195
- -> DepNode
196
- {
197
- match dep {
198
- $(
199
- DepConstructor :: $variant $( ( replace!( ( $tuple_arg_ty) with arg) ) ) *
200
- =>
201
- {
202
- // tuple args
203
- $( {
204
- erase!( $tuple_arg_ty) ;
205
- let hash = DepNodeParams :: to_fingerprint( & arg, tcx) ;
206
- let dep_node = DepNode {
207
- kind: DepKind :: $variant,
208
- hash
209
- } ;
210
-
211
- #[ cfg( debug_assertions) ]
212
- {
213
- if !dep_node. kind. can_reconstruct_query_key( ) &&
214
- ( tcx. sess. opts. debugging_opts. incremental_info ||
215
- tcx. sess. opts. debugging_opts. query_dep_graph)
216
- {
217
- tcx. dep_graph. register_dep_node_debug_str( dep_node, || {
218
- arg. to_debug_str( tcx)
219
- } ) ;
220
- }
221
- }
222
-
223
- return dep_node;
224
- } ) *
225
-
226
- DepNode {
227
- kind: DepKind :: $variant,
228
- hash: Fingerprint :: ZERO ,
229
- }
230
- }
231
- ) *
232
- }
233
- }
234
-
235
221
/// Construct a DepNode from the given DepKind and DefPathHash. This
236
222
/// method will assert that the given DepKind actually requires a
237
223
/// single DefId/DefPathHash parameter.
0 commit comments