@@ -10,7 +10,7 @@ use std::cmp::Ordering;
1010use std:: env:: VarError ;
1111use std:: ffi:: OsStr ;
1212use std:: hash:: { Hash , Hasher } ;
13- use std:: marker:: { PhantomData , PointeeSized } ;
13+ use std:: marker:: PointeeSized ;
1414use std:: ops:: { Bound , Deref } ;
1515use std:: sync:: { Arc , OnceLock } ;
1616use std:: { fmt, iter, mem} ;
@@ -539,36 +539,14 @@ pub struct FreeRegionInfo {
539539
540540/// This struct should only be created by `create_def`.
541541#[ derive( Copy , Clone ) ]
542- pub struct TyCtxtFeed < ' tcx , KEY : Copy > {
542+ pub struct TyCtxtFeed < ' tcx , K : Copy > {
543543 pub tcx : TyCtxt < ' tcx > ,
544544 // Do not allow direct access, as downstream code must not mutate this field.
545- key : KEY ,
545+ key : K ,
546546}
547547
548- /// Never return a `Feed` from a query. Only queries that create a `DefId` are
549- /// allowed to feed queries for that `DefId`.
550- impl < KEY : Copy > !HashStable for TyCtxtFeed < ' _ , KEY > { }
551-
552- /// The same as `TyCtxtFeed`, but does not contain a `TyCtxt`.
553- /// Use this to pass around when you have a `TyCtxt` elsewhere.
554- /// Just an optimization to save space and not store hundreds of
555- /// `TyCtxtFeed` in the resolver.
556- #[ derive( Copy , Clone ) ]
557- pub struct Feed < ' tcx , KEY : Copy > {
558- _tcx : PhantomData < TyCtxt < ' tcx > > ,
559- // Do not allow direct access, as downstream code must not mutate this field.
560- key : KEY ,
561- }
562-
563- /// Never return a `Feed` from a query. Only queries that create a `DefId` are
564- /// allowed to feed queries for that `DefId`.
565- impl < KEY : Copy > !HashStable for Feed < ' _ , KEY > { }
566-
567- impl < T : fmt:: Debug + Copy > fmt:: Debug for Feed < ' _ , T > {
568- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
569- self . key . fmt ( f)
570- }
571- }
548+ /// Only queries that create a `DefId` are allowed to feed queries for that `DefId`.
549+ impl < K : Copy > !HashStable for TyCtxtFeed < ' _ , K > { }
572550
573551/// Some workarounds to use cases that cannot use `create_def`.
574552/// Do not add new ways to create `TyCtxtFeed` without consulting
@@ -622,28 +600,11 @@ impl<'tcx> TyCtxt<'tcx> {
622600 }
623601}
624602
625- impl < ' tcx , KEY : Copy > TyCtxtFeed < ' tcx , KEY > {
603+ impl < ' tcx , K : Copy > TyCtxtFeed < ' tcx , K > {
626604 #[ inline( always) ]
627- pub fn key ( & self ) -> KEY {
605+ pub fn key ( & self ) -> K {
628606 self . key
629607 }
630-
631- #[ inline( always) ]
632- pub fn downgrade ( self ) -> Feed < ' tcx , KEY > {
633- Feed { _tcx : PhantomData , key : self . key }
634- }
635- }
636-
637- impl < ' tcx , KEY : Copy > Feed < ' tcx , KEY > {
638- #[ inline( always) ]
639- pub fn key ( & self ) -> KEY {
640- self . key
641- }
642-
643- #[ inline( always) ]
644- pub fn upgrade ( self , tcx : TyCtxt < ' tcx > ) -> TyCtxtFeed < ' tcx , KEY > {
645- TyCtxtFeed { tcx, key : self . key }
646- }
647608}
648609
649610impl < ' tcx > TyCtxtFeed < ' tcx , LocalDefId > {
0 commit comments