1
+ use derive_where:: derive_where;
1
2
#[ cfg( feature = "nightly" ) ]
2
3
use rustc_macros:: { HashStable_NoContext , TyDecodable , TyEncodable } ;
3
4
use rustc_type_ir_macros:: { Lift_Generic , TypeFoldable_Generic , TypeVisitable_Generic } ;
@@ -11,15 +12,12 @@ use crate::{self as ty, Interner, UniverseIndex};
11
12
/// A "canonicalized" type `V` is one where all free inference
12
13
/// variables have been rewritten to "canonical vars". These are
13
14
/// 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 ) ]
23
21
#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
24
22
#[ cfg_attr( feature = "nightly" , derive( TyEncodable , TyDecodable , HashStable_NoContext ) ) ]
25
23
pub struct Canonical < I : Interner , V > {
@@ -84,15 +82,7 @@ impl<I: Interner, V: fmt::Display> fmt::Display for Canonical<I, V> {
84
82
/// canonical value. This is sufficient information for code to create
85
83
/// a copy of the canonical value in some other inference context,
86
84
/// 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 ) ]
96
86
#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
97
87
#[ cfg_attr( feature = "nightly" , derive( TyDecodable , TyEncodable , HashStable_NoContext ) ) ]
98
88
pub struct CanonicalVarInfo < I : Interner > {
@@ -149,8 +139,7 @@ impl<I: Interner> CanonicalVarInfo<I> {
149
139
/// Describes the "kind" of the canonical variable. This is a "kind"
150
140
/// in the type-theory sense of the term -- i.e., a "meta" type system
151
141
/// 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 ) ]
154
143
#[ derive( TypeVisitable_Generic , TypeFoldable_Generic ) ]
155
144
#[ cfg_attr( feature = "nightly" , derive( TyDecodable , TyEncodable , HashStable_NoContext ) ) ]
156
145
pub enum CanonicalVarKind < I : Interner > {
@@ -266,15 +255,7 @@ pub enum CanonicalTyVarKind {
266
255
/// vectors with the original values that were replaced by canonical
267
256
/// variables. You will need to supply it later to instantiate the
268
257
/// 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 ) ]
278
259
#[ cfg_attr( feature = "nightly" , derive( TyEncodable , TyDecodable , HashStable_NoContext ) ) ]
279
260
#[ derive( TypeVisitable_Generic , TypeFoldable_Generic , Lift_Generic ) ]
280
261
pub struct CanonicalVarValues < I : Interner > {
0 commit comments