File tree Expand file tree Collapse file tree 2 files changed +20
-17
lines changed
compiler/rustc_middle/src/ty/query Expand file tree Collapse file tree 2 files changed +20
-17
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,18 @@ macro_rules! query_helper_param_ty {
133
133
( $K: ty) => { $K } ;
134
134
}
135
135
136
+ macro_rules! query_storage {
137
+ ( [ ] [ $K: ty, $V: ty] ) => {
138
+ <DefaultCacheSelector as CacheSelector <$K, $V>>:: Cache
139
+ } ;
140
+ ( [ storage( $ty: ty) $( $rest: tt) * ] [ $K: ty, $V: ty] ) => {
141
+ <$ty as CacheSelector <$K, $V>>:: Cache
142
+ } ;
143
+ ( [ $other: ident $( ( $( $other_args: tt) * ) ) * $( , $( $modifiers: tt) * ) * ] [ $( $args: tt) * ] ) => {
144
+ query_storage!( [ $( $( $modifiers) * ) * ] [ $( $args) * ] )
145
+ } ;
146
+ }
147
+
136
148
macro_rules! define_callbacks {
137
149
( <$tcx: tt>
138
150
$( $( #[ $attr: meta] ) *
@@ -157,13 +169,16 @@ macro_rules! define_callbacks {
157
169
$( pub type $name<$tcx> = $V; ) *
158
170
}
159
171
#[ allow( nonstandard_style, unused_lifetimes) ]
172
+ pub mod query_storage {
173
+ use super :: * ;
174
+
175
+ $( pub type $name<$tcx> = query_storage!( [ $( $modifiers) * ] [ $( $K) * , $V] ) ; ) *
176
+ }
177
+ #[ allow( nonstandard_style, unused_lifetimes) ]
160
178
pub mod query_stored {
161
179
use super :: * ;
162
180
163
- $( pub type $name<$tcx> = <
164
- query_storage!( [ $( $modifiers) * ] [ $( $K) * , $V] )
165
- as QueryStorage
166
- >:: Stored ; ) *
181
+ $( pub type $name<$tcx> = <query_storage:: $name<$tcx> as QueryStorage >:: Stored ; ) *
167
182
}
168
183
169
184
impl TyCtxtEnsure <$tcx> {
Original file line number Diff line number Diff line change @@ -407,18 +407,6 @@ macro_rules! is_eval_always {
407
407
} ;
408
408
}
409
409
410
- macro_rules! query_storage {
411
- ( [ ] [ $K: ty, $V: ty] ) => {
412
- <DefaultCacheSelector as CacheSelector <$K, $V>>:: Cache
413
- } ;
414
- ( [ storage( $ty: ty) $( $rest: tt) * ] [ $K: ty, $V: ty] ) => {
415
- <$ty as CacheSelector <$K, $V>>:: Cache
416
- } ;
417
- ( [ $other: ident $( ( $( $other_args: tt) * ) ) * $( , $( $modifiers: tt) * ) * ] [ $( $args: tt) * ] ) => {
418
- query_storage!( [ $( $( $modifiers) * ) * ] [ $( $args) * ] )
419
- } ;
420
- }
421
-
422
410
macro_rules! hash_result {
423
411
( [ ] [ $hcx: expr, $result: expr] ) => { {
424
412
dep_graph:: hash_result( $hcx, & $result)
@@ -520,7 +508,7 @@ macro_rules! define_queries {
520
508
const EVAL_ALWAYS : bool = is_eval_always!( [ $( $modifiers) * ] ) ;
521
509
const DEP_KIND : dep_graph:: DepKind = dep_graph:: DepKind :: $name;
522
510
523
- type Cache = query_storage! ( [ $ ( $modifiers ) * ] [ $ ( $K ) * , $V ] ) ;
511
+ type Cache = query_storage:: $name<$tcx> ;
524
512
525
513
#[ inline( always) ]
526
514
fn query_state<' a>( tcx: QueryCtxt <$tcx>) -> & ' a QueryState <crate :: dep_graph:: DepKind , Query <$tcx>, Self :: Cache > {
You can’t perform that action at this time.
0 commit comments