@@ -151,21 +151,17 @@ macro_rules! query_if_arena {
151
151
} ;
152
152
}
153
153
154
- macro_rules! separate_provide_local_decl {
155
- ( [ ] [ $name: ident] ) => {
156
- for <' tcx> fn (
157
- TyCtxt <' tcx>,
158
- query_keys:: $name<' tcx>,
159
- ) -> query_provided:: $name<' tcx>
154
+ /// If `separate_provide_if_extern`, then the key can be projected to its
155
+ /// local key via `<$K as AsLocalKey>::LocalKey`.
156
+ macro_rules! local_key_if_separate_extern {
157
+ ( [ ] $( $K: tt) * ) => {
158
+ $( $K) *
160
159
} ;
161
- ( [ ( separate_provide_extern) $( $rest: tt) * ] [ $name: ident] ) => {
162
- for <' tcx> fn (
163
- TyCtxt <' tcx>,
164
- query_keys_local:: $name<' tcx>,
165
- ) -> query_provided:: $name<' tcx>
160
+ ( [ ( separate_provide_extern) $( $rest: tt) * ] $( $K: tt) * ) => {
161
+ <$( $K) * as AsLocalKey >:: LocalKey
166
162
} ;
167
- ( [ $other: tt $( $modifiers: tt) * ] [ $( $args : tt) * ] ) => {
168
- separate_provide_local_decl !( [ $( $modifiers) * ] [ $( $args ) * ] )
163
+ ( [ $other: tt $( $modifiers: tt) * ] $( $K : tt) * ) => {
164
+ local_key_if_separate_extern !( [ $( $modifiers) * ] $( $K ) * )
169
165
} ;
170
166
}
171
167
@@ -233,7 +229,7 @@ macro_rules! define_callbacks {
233
229
pub mod query_keys_local {
234
230
use super :: * ;
235
231
236
- $( pub type $name<' tcx> = < $( $K ) * as AsLocalKey > :: LocalKey ; ) *
232
+ $( pub type $name<' tcx> = local_key_if_separate_extern! ( [ $( $modifiers ) * ] $ ( $K ) * ) ; ) *
237
233
}
238
234
#[ allow( nonstandard_style, unused_lifetimes) ]
239
235
pub mod query_values {
@@ -407,7 +403,10 @@ macro_rules! define_callbacks {
407
403
}
408
404
409
405
pub struct Providers {
410
- $( pub $name: separate_provide_local_decl!( [ $( $modifiers) * ] [ $name] ) , ) *
406
+ $( pub $name: for <' tcx> fn (
407
+ TyCtxt <' tcx>,
408
+ query_keys_local:: $name<' tcx>,
409
+ ) -> query_provided:: $name<' tcx>, ) *
411
410
}
412
411
413
412
pub struct ExternProviders {
0 commit comments