@@ -234,18 +234,23 @@ macro_rules! hash_result {
234234
235235macro_rules!  define_queries { 
236236    ( <$tcx: tt> $( $category: tt { 
237-         $( $( #[ $attr: meta] ) *  [ $( $modifiers: tt) * ]  fn  $name: ident:  $node: ident( $K : ty )  -> $V: ty, ) * 
237+         $( $( #[ $attr: meta] ) *  [ $( $modifiers: tt) * ]  fn  $name: ident:  $node: ident( $( $K : tt ) * )  -> $V: ty, ) * 
238238    } , ) * )  => { 
239239        define_queries_inner! {  <$tcx>
240-             $( $(  $( #[ $attr] ) *  category<$category> [ $( $modifiers) * ]  fn  $name:  $node( $K )  -> $V, ) * ) * 
240+             $( $(  $( #[ $attr] ) *  category<$category> [ $( $modifiers) * ]  fn  $name:  $node( $( $K ) * )  -> $V, ) * ) * 
241241        } 
242242    } 
243243} 
244244
245+ macro_rules!  query_helper_param_ty { 
246+     ( DefId )  => {  impl  IntoQueryParam <DefId > } ; 
247+     ( $K: ty)  => {  $K } ; 
248+ } 
249+ 
245250macro_rules!  define_queries_inner { 
246251    ( <$tcx: tt>
247252     $( $( #[ $attr: meta] ) *  category<$category: tt>
248-         [ $( $modifiers: tt) * ]  fn  $name: ident:  $node: ident( $K : ty )  -> $V: ty, ) * )  => { 
253+         [ $( $modifiers: tt) * ]  fn  $name: ident:  $node: ident( $( $K : tt ) * )  -> $V: ty, ) * )  => { 
249254
250255        use  std:: mem; 
251256        use  crate :: { 
@@ -263,7 +268,7 @@ macro_rules! define_queries_inner {
263268        #[ allow( nonstandard_style) ] 
264269        #[ derive( Clone ,  Debug ) ] 
265270        pub  enum  Query <$tcx> { 
266-             $( $( #[ $attr] ) *  $name( $K ) ) ,* 
271+             $( $( #[ $attr] ) *  $name( $( $K ) * ) ) ,* 
267272        } 
268273
269274        impl <$tcx> Query <$tcx> { 
@@ -321,7 +326,7 @@ macro_rules! define_queries_inner {
321326        } 
322327
323328        $( impl <$tcx> QueryConfig <TyCtxt <$tcx>> for  queries:: $name<$tcx> { 
324-             type  Key  = $K ; 
329+             type  Key  = $( $K ) * ; 
325330            type  Value  = $V; 
326331            const  NAME :  & ' static  str  = stringify!( $name) ; 
327332            const  CATEGORY :  ProfileCategory  = $category; 
@@ -332,7 +337,7 @@ macro_rules! define_queries_inner {
332337            const  EVAL_ALWAYS :  bool  = is_eval_always!( [ $( $modifiers) * ] ) ; 
333338            const  DEP_KIND :  dep_graph:: DepKind  = dep_graph:: DepKind :: $node; 
334339
335-             type  Cache  = query_storage!( [ $( $modifiers) * ] [ $K ,  $V] ) ; 
340+             type  Cache  = query_storage!( [ $( $modifiers) * ] [ $( $K ) * ,  $V] ) ; 
336341
337342            #[ inline( always) ] 
338343            fn  query_state<' a>( tcx:  TyCtxt <$tcx>)  -> & ' a QueryState <TyCtxt <$tcx>,  Self :: Cache > { 
@@ -380,8 +385,8 @@ macro_rules! define_queries_inner {
380385        impl  TyCtxtEnsure <$tcx> { 
381386            $( $( #[ $attr] ) * 
382387            #[ inline( always) ] 
383-             pub  fn  $name( self ,  key:  $K )  { 
384-                 ensure_query:: <queries:: $name<' _>,  _>( self . tcx,  key) 
388+             pub  fn  $name( self ,  key:  query_helper_param_ty! ( $ ( $K ) * ) )  { 
389+                 ensure_query:: <queries:: $name<' _>,  _>( self . tcx,  key. into_query_param ( ) ) 
385390            } ) * 
386391        } 
387392
@@ -421,7 +426,7 @@ macro_rules! define_queries_inner {
421426
422427            $( $( #[ $attr] ) * 
423428            #[ inline( always) ] 
424-             pub  fn  $name( self ,  key:  $K )  -> $V { 
429+             pub  fn  $name( self ,  key:  query_helper_param_ty! ( $ ( $K ) * ) )  -> $V { 
425430                self . at( DUMMY_SP ) . $name( key) 
426431            } ) * 
427432
@@ -458,14 +463,14 @@ macro_rules! define_queries_inner {
458463        impl  TyCtxtAt <$tcx> { 
459464            $( $( #[ $attr] ) * 
460465            #[ inline( always) ] 
461-             pub  fn  $name( self ,  key:  $K )  -> $V { 
462-                 get_query:: <queries:: $name<' _>,  _>( self . tcx,  self . span,  key) 
466+             pub  fn  $name( self ,  key:  query_helper_param_ty! ( $ ( $K ) * ) )  -> $V { 
467+                 get_query:: <queries:: $name<' _>,  _>( self . tcx,  self . span,  key. into_query_param ( ) ) 
463468            } ) * 
464469        } 
465470
466471        define_provider_struct! { 
467472            tcx:  $tcx, 
468-             input:  ( $( ( [ $( $modifiers) * ]  [ $name]  [ $K ]  [ $V] ) ) * ) 
473+             input:  ( $( ( [ $( $modifiers) * ]  [ $name]  [ $( $K ) * ]  [ $V] ) ) * ) 
469474        } 
470475
471476        impl <$tcx> Copy  for  Providers <$tcx> { } 
0 commit comments