@@ -6,10 +6,7 @@ use rustc_data_structures::hash_table::HashTable;
66use rustc_data_structures:: sharded:: Sharded ;
77use rustc_data_structures:: sync:: { AtomicU64 , WorkerLocal } ;
88use rustc_errors:: Diag ;
9- use rustc_hir:: def_id:: { DefId , LocalDefId } ;
10- use rustc_hir:: hir_id:: OwnerId ;
119use rustc_span:: { Span , Spanned } ;
12- pub use sealed:: IntoQueryParam ;
1310
1411use crate :: dep_graph:: { DepKind , DepNodeIndex , SerializedDepNodeIndex } ;
1512use crate :: ich:: StableHashingContext ;
@@ -272,8 +269,8 @@ impl<'tcx> TyCtxt<'tcx> {
272269}
273270
274271macro_rules! query_helper_param_ty {
275- ( DefId ) => { impl $crate:: query:: IntoQueryParam <DefId > } ;
276- ( LocalDefId ) => { impl $crate:: query:: IntoQueryParam <LocalDefId > } ;
272+ ( DefId ) => { impl $crate:: query:: IntoQueryKey <DefId > } ;
273+ ( LocalDefId ) => { impl $crate:: query:: IntoQueryKey <LocalDefId > } ;
277274 ( $K: ty) => { $K } ;
278275}
279276
@@ -414,7 +411,7 @@ macro_rules! define_callbacks {
414411 crate :: query:: inner:: query_ensure_ok_or_done(
415412 self . tcx,
416413 & self . tcx. query_system. query_vtables. $name,
417- $crate:: query:: IntoQueryParam :: into_query_param ( key) ,
414+ $crate:: query:: IntoQueryKey :: into_query_key ( key) ,
418415 $crate:: query:: EnsureMode :: Ok ,
419416 )
420417 }
@@ -434,7 +431,7 @@ macro_rules! define_callbacks {
434431 crate :: query:: inner:: query_ensure_result(
435432 self . tcx,
436433 & self . tcx. query_system. query_vtables. $name,
437- $crate:: query:: IntoQueryParam :: into_query_param ( key) ,
434+ $crate:: query:: IntoQueryKey :: into_query_key ( key) ,
438435 )
439436 }
440437 ) *
@@ -448,7 +445,7 @@ macro_rules! define_callbacks {
448445 crate :: query:: inner:: query_ensure_ok_or_done(
449446 self . tcx,
450447 & self . tcx. query_system. query_vtables. $name,
451- $crate:: query:: IntoQueryParam :: into_query_param ( key) ,
448+ $crate:: query:: IntoQueryKey :: into_query_key ( key) ,
452449 $crate:: query:: EnsureMode :: Done ,
453450 ) ;
454451 }
@@ -477,21 +474,21 @@ macro_rules! define_callbacks {
477474 self . tcx,
478475 self . span,
479476 & self . tcx. query_system. query_vtables. $name,
480- $crate:: query:: IntoQueryParam :: into_query_param ( key) ,
477+ $crate:: query:: IntoQueryKey :: into_query_key ( key) ,
481478 ) )
482479 }
483480 ) *
484481 }
485482
486483 $(
487484 #[ cfg( $feedable) ]
488- impl <' tcx, K : $crate:: query:: IntoQueryParam <$name:: Key <' tcx>> + Copy >
485+ impl <' tcx, K : $crate:: query:: IntoQueryKey <$name:: Key <' tcx>> + Copy >
489486 TyCtxtFeed <' tcx, K >
490487 {
491488 $( #[ $attr] ) *
492489 #[ inline( always) ]
493490 pub fn $name( self , value: $name:: ProvidedValue <' tcx>) {
494- let key = self . key( ) . into_query_param ( ) ;
491+ let key = self . key( ) . into_query_key ( ) ;
495492 let erased_value = $name:: provided_to_erased( self . tcx, value) ;
496493 $crate:: query:: inner:: query_feed(
497494 self . tcx,
@@ -648,69 +645,6 @@ macro_rules! define_callbacks {
648645pub ( crate ) use define_callbacks;
649646pub ( crate ) use query_helper_param_ty;
650647
651- mod sealed {
652- use rustc_hir:: def_id:: { LocalModDefId , ModDefId } ;
653-
654- use super :: { DefId , LocalDefId , OwnerId } ;
655-
656- /// An analogue of the `Into` trait that's intended only for query parameters.
657- ///
658- /// This exists to allow queries to accept either `DefId` or `LocalDefId` while requiring that the
659- /// user call `to_def_id` to convert between them everywhere else.
660- pub trait IntoQueryParam < P > {
661- fn into_query_param ( self ) -> P ;
662- }
663-
664- impl < P > IntoQueryParam < P > for P {
665- #[ inline( always) ]
666- fn into_query_param ( self ) -> P {
667- self
668- }
669- }
670-
671- impl IntoQueryParam < LocalDefId > for OwnerId {
672- #[ inline( always) ]
673- fn into_query_param ( self ) -> LocalDefId {
674- self . def_id
675- }
676- }
677-
678- impl IntoQueryParam < DefId > for LocalDefId {
679- #[ inline( always) ]
680- fn into_query_param ( self ) -> DefId {
681- self . to_def_id ( )
682- }
683- }
684-
685- impl IntoQueryParam < DefId > for OwnerId {
686- #[ inline( always) ]
687- fn into_query_param ( self ) -> DefId {
688- self . to_def_id ( )
689- }
690- }
691-
692- impl IntoQueryParam < DefId > for ModDefId {
693- #[ inline( always) ]
694- fn into_query_param ( self ) -> DefId {
695- self . to_def_id ( )
696- }
697- }
698-
699- impl IntoQueryParam < DefId > for LocalModDefId {
700- #[ inline( always) ]
701- fn into_query_param ( self ) -> DefId {
702- self . to_def_id ( )
703- }
704- }
705-
706- impl IntoQueryParam < LocalDefId > for LocalModDefId {
707- #[ inline( always) ]
708- fn into_query_param ( self ) -> LocalDefId {
709- self . into ( )
710- }
711- }
712- }
713-
714648#[ cold]
715649pub ( crate ) fn default_query ( name : & str , key : & dyn std:: fmt:: Debug ) -> ! {
716650 bug ! (
0 commit comments