@@ -221,8 +221,8 @@ macro_rules! separate_provide_extern_decl {
221221    ( [ ( separate_provide_extern)  $( $rest: tt) * ] [ $name: ident] )  => { 
222222        for <' tcx> fn ( 
223223            TyCtxt <' tcx>, 
224-             query_keys :: $name<' tcx>, 
225-         )  -> query_provided :: $name<' tcx>
224+             queries :: $name:: Key <' tcx>, 
225+         )  -> queries :: $name:: ProvidedValue <' tcx>
226226    } ; 
227227    ( [ $other: tt $( $modifiers: tt) * ] [ $( $args: tt) * ] )  => { 
228228        separate_provide_extern_decl!( [ $( $modifiers) * ] [ $( $args) * ] ) 
@@ -252,60 +252,37 @@ macro_rules! define_callbacks {
252252     $( $( #[ $attr: meta] ) * 
253253        [ $( $modifiers: tt) * ]  fn  $name: ident( $( $K: tt) * )  -> $V: ty, ) * )  => { 
254254
255-         // HACK(eddyb) this is like the `impl QueryConfig for queries::$name` 
256-         // below, but using type aliases instead of associated types, to bypass 
257-         // the limitations around normalizing under HRTB - for example, this: 
258-         // `for<'tcx> fn(...) -> <queries::$name<'tcx> as QueryConfig<TyCtxt<'tcx>>>::Value` 
259-         // doesn't currently normalize to `for<'tcx> fn(...) -> query_values::$name<'tcx>`. 
260-         // This is primarily used by the `provide!` macro in `rustc_metadata`. 
261-         #[ allow( nonstandard_style,  unused_lifetimes) ] 
262-         pub  mod  query_keys { 
263-             use  super :: * ; 
264- 
265-             $( pub  type  $name<' tcx> = $( $K) * ; ) * 
266-         } 
267-         #[ allow( nonstandard_style,  unused_lifetimes) ] 
268-         pub  mod  query_keys_local { 
269-             use  super :: * ; 
270- 
271-             $( pub  type  $name<' tcx> = local_key_if_separate_extern!( [ $( $modifiers) * ]  $( $K) * ) ; ) * 
272-         } 
273-         #[ allow( nonstandard_style,  unused_lifetimes) ] 
274-         pub  mod  query_values { 
275-             use  super :: * ; 
255+         #[ allow( unused_lifetimes) ] 
256+         pub  mod  queries { 
257+             $( pub  mod  $name { 
258+                 use  super :: super :: * ; 
276259
277-             $ ( pub  type  $name <' tcx> = $V ; ) * 
278-         } 
260+                  pub  type  Key <' tcx> = $( $K ) * ; 
261+                  pub   type   Value < ' tcx> = $V ; 
279262
280-         /// This module specifies the type returned from query providers and the type used for 
281-          /// decoding. For regular queries this is the declared returned type `V`, but 
282-          /// `arena_cache` will use `<V as Deref>::Target` instead. 
283-          #[ allow( nonstandard_style,  unused_lifetimes) ] 
284-         pub  mod  query_provided { 
285-             use  super :: * ; 
263+                 pub  type  LocalKey <' tcx> = local_key_if_separate_extern!( [ $( $modifiers) * ]  $( $K) * ) ; 
286264
287-             $( 
288-                 pub  type  $name<' tcx> = query_if_arena!( [ $( $modifiers) * ]  ( <$V as  Deref >:: Target )  ( $V) ) ; 
289-             ) * 
290-         } 
291- 
292-         /// This module has a function per query which takes a `query_provided` value and coverts 
293-          /// it to a regular `V` value by allocating it on an arena if the query has the 
294-          /// `arena_cache` modifier. This will happen when computing the query using a provider or 
295-          /// decoding a stored result. 
296-          #[ allow( nonstandard_style,  unused_lifetimes) ] 
297-         pub  mod  query_provided_to_value { 
298-             use  super :: * ; 
265+                 /// This type alias specifies the type returned from query providers and the type 
266+                  /// used for decoding. For regular queries this is the declared returned type `V`, 
267+                  /// but `arena_cache` will use `<V as Deref>::Target` instead. 
268+                  pub  type  ProvidedValue <' tcx> = query_if_arena!( 
269+                     [ $( $modifiers) * ] 
270+                     ( <$V as  Deref >:: Target ) 
271+                     ( $V) 
272+                 ) ; 
299273
300-             $( 
274+                 /// This function takes `ProvidedValue` and coverts it to an erased `Value` by 
275+                  /// allocating it on an arena if the query has the `arena_cache` modifier. The 
276+                  /// value is then erased and returned. This will happen when computing the query 
277+                  /// using a provider or decoding a stored result. 
301278                 #[ inline( always) ] 
302-                 pub  fn  $name <' tcx>( 
279+                 pub  fn  provided_to_erased <' tcx>( 
303280                    _tcx:  TyCtxt <' tcx>, 
304-                     value:  query_provided :: $name <' tcx>, 
305-                 )  -> Erase <query_values :: $name <' tcx>> { 
281+                     value:  ProvidedValue <' tcx>, 
282+                 )  -> Erase <Value <' tcx>> { 
306283                    erase( query_if_arena!( [ $( $modifiers) * ] 
307284                        { 
308-                             if  mem:: needs_drop:: <query_provided :: $name <' tcx>>( )  { 
285+                             if  mem:: needs_drop:: <ProvidedValue <' tcx>>( )  { 
309286                                & * _tcx. query_system. arenas. $name. alloc( value) 
310287                            }  else { 
311288                                & * _tcx. arena. dropless. alloc( value) 
@@ -314,47 +291,41 @@ macro_rules! define_callbacks {
314291                        ( value) 
315292                    ) ) 
316293                } 
317-             ) * 
318-         } 
319-         #[ allow( nonstandard_style,  unused_lifetimes) ] 
320-         pub  mod  query_storage { 
321-             use  super :: * ; 
322294
323-             $( 
324-                 pub  type  $name<' tcx> = <<$( $K) *  as  Key >:: CacheSelector  as  CacheSelector <' tcx,  Erase <$V>>>:: Cache ; 
325-             ) * 
295+                 pub  type  Storage <' tcx> = <
296+                     <$( $K) *  as  keys:: Key >:: CacheSelector  as  CacheSelector <' tcx,  Erase <$V>>
297+                 >:: Cache ; 
298+ 
299+                 // Ensure that keys grow no larger than 64 bytes 
300+                 #[ cfg( all( target_arch = "x86_64" ,  target_pointer_width = "64" ) ) ] 
301+                 const  _:  ( )  = { 
302+                     if  mem:: size_of:: <Key <' static >>( )  > 64  { 
303+                         panic!( "{}" ,  concat!( 
304+                             "the query `" , 
305+                             stringify!( $name) , 
306+                             "` has a key type `" , 
307+                             stringify!( $( $K) * ) , 
308+                             "` that is too large" 
309+                         ) ) ; 
310+                     } 
311+                 } ; 
312+ 
313+                 // Ensure that values grow no larger than 64 bytes 
314+                 #[ cfg( all( target_arch = "x86_64" ,  target_pointer_width = "64" ) ) ] 
315+                 const  _:  ( )  = { 
316+                     if  mem:: size_of:: <Value <' static >>( )  > 64  { 
317+                         panic!( "{}" ,  concat!( 
318+                             "the query `" , 
319+                             stringify!( $name) , 
320+                             "` has a value type `" , 
321+                             stringify!( $V) , 
322+                             "` that is too large" 
323+                         ) ) ; 
324+                     } 
325+                 } ; 
326+             } ) * 
326327        } 
327328
328-         $( 
329-             // Ensure that keys grow no larger than 64 bytes 
330-             #[ cfg( all( target_arch = "x86_64" ,  target_pointer_width = "64" ) ) ] 
331-             const  _:  ( )  = { 
332-                 if  mem:: size_of:: <query_keys:: $name<' static >>( )  > 64  { 
333-                     panic!( "{}" ,  concat!( 
334-                         "the query `" , 
335-                         stringify!( $name) , 
336-                         "` has a key type `" , 
337-                         stringify!( $( $K) * ) , 
338-                         "` that is too large" 
339-                     ) ) ; 
340-                 } 
341-             } ; 
342- 
343-             // Ensure that values grow no larger than 64 bytes 
344-             #[ cfg( all( target_arch = "x86_64" ,  target_pointer_width = "64" ) ) ] 
345-             const  _:  ( )  = { 
346-                 if  mem:: size_of:: <query_values:: $name<' static >>( )  > 64  { 
347-                     panic!( "{}" ,  concat!( 
348-                         "the query `" , 
349-                         stringify!( $name) , 
350-                         "` has a value type `" , 
351-                         stringify!( $V) , 
352-                         "` that is too large" 
353-                     ) ) ; 
354-                 } 
355-             } ; 
356-         ) * 
357- 
358329        pub  struct  QueryArenas <' tcx> { 
359330            $( $( #[ $attr] ) *  pub  $name:  query_if_arena!( [ $( $modifiers) * ] 
360331                ( WorkerLocal <TypedArena <<$V as  Deref >:: Target >>) 
@@ -375,7 +346,7 @@ macro_rules! define_callbacks {
375346
376347        #[ derive( Default ) ] 
377348        pub  struct  QueryCaches <' tcx> { 
378-             $( $( #[ $attr] ) *  pub  $name:  query_storage :: $name<' tcx>, ) * 
349+             $( $( #[ $attr] ) *  pub  $name:  queries :: $name:: Storage <' tcx>, ) * 
379350        } 
380351
381352        impl <' tcx> TyCtxtEnsure <' tcx> { 
@@ -433,7 +404,7 @@ macro_rules! define_callbacks {
433404
434405        pub  struct  DynamicQueries <' tcx> { 
435406            $( 
436-                 pub  $name:  DynamicQuery <' tcx,  query_storage :: $name<' tcx>>, 
407+                 pub  $name:  DynamicQuery <' tcx,  queries :: $name:: Storage <' tcx>>, 
437408            ) * 
438409        } 
439410
@@ -447,8 +418,8 @@ macro_rules! define_callbacks {
447418        pub  struct  Providers  { 
448419            $( pub  $name:  for <' tcx> fn ( 
449420                TyCtxt <' tcx>, 
450-                 query_keys_local :: $name<' tcx>, 
451-             )  -> query_provided :: $name<' tcx>, ) * 
421+                 queries :: $name:: LocalKey <' tcx>, 
422+             )  -> queries :: $name:: ProvidedValue <' tcx>, ) * 
452423        } 
453424
454425        pub  struct  ExternProviders  { 
@@ -493,7 +464,7 @@ macro_rules! define_callbacks {
493464            $( pub  $name:  for <' tcx> fn ( 
494465                TyCtxt <' tcx>, 
495466                Span , 
496-                 query_keys :: $name<' tcx>, 
467+                 queries :: $name:: Key <' tcx>, 
497468                QueryMode , 
498469            )  -> Option <Erase <$V>>, ) * 
499470        } 
@@ -517,11 +488,11 @@ macro_rules! define_feedable {
517488        $( impl <' tcx,  K :  IntoQueryParam <$( $K) * > + Copy > TyCtxtFeed <' tcx,  K > { 
518489            $( #[ $attr] ) * 
519490            #[ inline( always) ] 
520-             pub  fn  $name( self ,  value:  query_provided :: $name<' tcx>)  { 
491+             pub  fn  $name( self ,  value:  queries :: $name:: ProvidedValue <' tcx>)  { 
521492                let  key = self . key( ) . into_query_param( ) ; 
522493
523494                let  tcx = self . tcx; 
524-                 let  erased = query_provided_to_value :: $name( tcx,  value) ; 
495+                 let  erased = queries :: $name:: provided_to_erased ( tcx,  value) ; 
525496                let  value = restore:: <$V>( erased) ; 
526497                let  cache = & tcx. query_system. caches. $name; 
527498
0 commit comments