1+ use derive_where:: derive_where;
12#[ cfg( feature = "nightly" ) ]
23use rustc_macros:: { HashStable_NoContext , TyDecodable , TyEncodable } ;
34use rustc_type_ir_macros:: { Lift_Generic , TypeFoldable_Generic , TypeVisitable_Generic } ;
@@ -11,15 +12,12 @@ use crate::{self as ty, Interner, UniverseIndex};
1112/// A "canonicalized" type `V` is one where all free inference
1213/// variables have been rewritten to "canonical vars". These are
1314/// numbered starting from 0 in order of first appearance.
14- #[ derive( derivative:: Derivative ) ]
15- #[ derivative(
16- Clone ( bound = "V: Clone" ) ,
17- Hash ( bound = "V: Hash" ) ,
18- PartialEq ( bound = "V: PartialEq" ) ,
19- Eq ( bound = "V: Eq" ) ,
20- Debug ( bound = "V: fmt::Debug" ) ,
21- Copy ( bound = "V: Copy" )
22- ) ]
15+ #[ derive_where( Clone ; I : Interner , V : Clone ) ]
16+ #[ derive_where( Hash ; I : Interner , V : Hash ) ]
17+ #[ derive_where( PartialEq ; I : Interner , V : PartialEq ) ]
18+ #[ derive_where( Eq ; I : Interner , V : Eq ) ]
19+ #[ derive_where( Debug ; I : Interner , V : fmt:: Debug ) ]
20+ #[ derive_where( Copy ; I : Interner , V : Copy ) ]
2321#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
2422#[ cfg_attr( feature = "nightly" , derive( TyEncodable , TyDecodable , HashStable_NoContext ) ) ]
2523pub struct Canonical < I : Interner , V > {
@@ -84,15 +82,7 @@ impl<I: Interner, V: fmt::Display> fmt::Display for Canonical<I, V> {
8482/// canonical value. This is sufficient information for code to create
8583/// a copy of the canonical value in some other inference context,
8684/// with fresh inference variables replacing the canonical values.
87- #[ derive( derivative:: Derivative ) ]
88- #[ derivative(
89- Clone ( bound = "" ) ,
90- Copy ( bound = "" ) ,
91- Hash ( bound = "" ) ,
92- Debug ( bound = "" ) ,
93- Eq ( bound = "" ) ,
94- PartialEq ( bound = "" )
95- ) ]
85+ #[ derive_where( Clone , Copy , Hash , PartialEq , Eq , Debug ; I : Interner ) ]
9686#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
9787#[ cfg_attr( feature = "nightly" , derive( TyDecodable , TyEncodable , HashStable_NoContext ) ) ]
9888pub struct CanonicalVarInfo < I : Interner > {
@@ -149,8 +139,7 @@ impl<I: Interner> CanonicalVarInfo<I> {
149139/// Describes the "kind" of the canonical variable. This is a "kind"
150140/// in the type-theory sense of the term -- i.e., a "meta" type system
151141/// that analyzes type-like values.
152- #[ derive( derivative:: Derivative ) ]
153- #[ derivative( Clone ( bound = "" ) , Copy ( bound = "" ) , Hash ( bound = "" ) , Debug ( bound = "" ) ) ]
142+ #[ derive_where( Clone , Copy , Hash , Eq , Debug ; I : Interner ) ]
154143#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
155144#[ cfg_attr( feature = "nightly" , derive( TyDecodable , TyEncodable , HashStable_NoContext ) ) ]
156145pub enum CanonicalVarKind < I : Interner > {
@@ -266,15 +255,7 @@ pub enum CanonicalTyVarKind {
266255/// vectors with the original values that were replaced by canonical
267256/// variables. You will need to supply it later to instantiate the
268257/// canonicalized query response.
269- #[ derive( derivative:: Derivative ) ]
270- #[ derivative(
271- Clone ( bound = "" ) ,
272- Copy ( bound = "" ) ,
273- PartialEq ( bound = "" ) ,
274- Eq ( bound = "" ) ,
275- Hash ( bound = "" ) ,
276- Debug ( bound = "" )
277- ) ]
258+ #[ derive_where( Clone , Copy , Hash , PartialEq , Eq , Debug ; I : Interner ) ]
278259#[ cfg_attr( feature = "nightly" , derive( TyEncodable , TyDecodable , HashStable_NoContext ) ) ]
279260#[ derive( TypeVisitable_Generic , TypeFoldable_Generic , Lift_Generic ) ]
280261pub struct CanonicalVarValues < I : Interner > {
0 commit comments