@@ -43,7 +43,8 @@ mod substitute;
4343/// A "canonicalized" type `V` is one where all free inference
4444/// variables have been rewritten to "canonical vars". These are
4545/// numbered starting from 0 in order of first appearance.
46- #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , RustcDecodable , RustcEncodable , HashStable ) ]
46+ #[ derive( Copy , Clone , Debug , PartialEq , Eq , Hash , RustcDecodable , RustcEncodable ) ]
47+ #[ derive( HashStable , TypeFoldable ) ]
4748pub struct Canonical < ' tcx , V > {
4849 pub max_universe : ty:: UniverseIndex ,
4950 pub variables : CanonicalVarInfos < ' tcx > ,
@@ -63,7 +64,8 @@ impl<'tcx> UseSpecializedDecodable for CanonicalVarInfos<'tcx> {}
6364/// vectors with the original values that were replaced by canonical
6465/// variables. You will need to supply it later to instantiate the
6566/// canonicalized query response.
66- #[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcDecodable , RustcEncodable , HashStable ) ]
67+ #[ derive( Clone , Debug , PartialEq , Eq , Hash , RustcDecodable , RustcEncodable ) ]
68+ #[ derive( HashStable , TypeFoldable ) ]
6769pub struct CanonicalVarValues < ' tcx > {
6870 pub var_values : IndexVec < BoundVar , GenericArg < ' tcx > > ,
6971}
@@ -186,15 +188,15 @@ pub enum CanonicalTyVarKind {
186188/// After we execute a query with a canonicalized key, we get back a
187189/// `Canonical<QueryResponse<..>>`. You can use
188190/// `instantiate_query_result` to access the data in this result.
189- #[ derive( Clone , Debug , HashStable ) ]
191+ #[ derive( Clone , Debug , HashStable , TypeFoldable ) ]
190192pub struct QueryResponse < ' tcx , R > {
191193 pub var_values : CanonicalVarValues < ' tcx > ,
192194 pub region_constraints : QueryRegionConstraints < ' tcx > ,
193195 pub certainty : Certainty ,
194196 pub value : R ,
195197}
196198
197- #[ derive( Clone , Debug , Default , HashStable ) ]
199+ #[ derive( Clone , Debug , Default , HashStable , TypeFoldable ) ]
198200pub struct QueryRegionConstraints < ' tcx > {
199201 pub outlives : Vec < QueryOutlivesConstraint < ' tcx > > ,
200202 pub member_constraints : Vec < MemberConstraint < ' tcx > > ,
@@ -467,14 +469,6 @@ CloneTypeFoldableImpls! {
467469 }
468470}
469471
470- BraceStructTypeFoldableImpl ! {
471- impl <' tcx, C > TypeFoldable <' tcx> for Canonical <' tcx, C > {
472- max_universe,
473- variables,
474- value,
475- } where C : TypeFoldable <' tcx>
476- }
477-
478472BraceStructLiftImpl ! {
479473 impl <' a, ' tcx, T > Lift <' tcx> for Canonical <' a, T > {
480474 type Lifted = Canonical <' tcx, T :: Lifted >;
@@ -534,31 +528,13 @@ BraceStructLiftImpl! {
534528 }
535529}
536530
537- BraceStructTypeFoldableImpl ! {
538- impl <' tcx> TypeFoldable <' tcx> for CanonicalVarValues <' tcx> {
539- var_values,
540- }
541- }
542-
543- BraceStructTypeFoldableImpl ! {
544- impl <' tcx, R > TypeFoldable <' tcx> for QueryResponse <' tcx, R > {
545- var_values, region_constraints, certainty, value
546- } where R : TypeFoldable <' tcx>,
547- }
548-
549531BraceStructLiftImpl ! {
550532 impl <' a, ' tcx, R > Lift <' tcx> for QueryResponse <' a, R > {
551533 type Lifted = QueryResponse <' tcx, R :: Lifted >;
552534 var_values, region_constraints, certainty, value
553535 } where R : Lift <' tcx>
554536}
555537
556- BraceStructTypeFoldableImpl ! {
557- impl <' tcx> TypeFoldable <' tcx> for QueryRegionConstraints <' tcx> {
558- outlives, member_constraints
559- }
560- }
561-
562538BraceStructLiftImpl ! {
563539 impl <' a, ' tcx> Lift <' tcx> for QueryRegionConstraints <' a> {
564540 type Lifted = QueryRegionConstraints <' tcx>;
0 commit comments