@@ -114,6 +114,8 @@ pub enum AliasKind {
114
114
/// Types written by the user start out as `hir::TyKind` and get
115
115
/// converted to this representation using `AstConv::ast_ty_to_ty`.
116
116
#[ rustc_diagnostic_item = "IrTyKind" ]
117
+ #[ derive( derivative:: Derivative ) ]
118
+ #[ derivative( Clone ( bound = "" ) ) ]
117
119
pub enum TyKind < I : Interner > {
118
120
/// The primitive boolean type. Written as `bool`.
119
121
Bool ,
@@ -324,40 +326,6 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
324
326
}
325
327
}
326
328
327
- // This is manually implemented because a derive would require `I: Clone`
328
- impl < I : Interner > Clone for TyKind < I > {
329
- fn clone ( & self ) -> Self {
330
- match self {
331
- Bool => Bool ,
332
- Char => Char ,
333
- Int ( i) => Int ( * i) ,
334
- Uint ( u) => Uint ( * u) ,
335
- Float ( f) => Float ( * f) ,
336
- Adt ( d, s) => Adt ( d. clone ( ) , s. clone ( ) ) ,
337
- Foreign ( d) => Foreign ( d. clone ( ) ) ,
338
- Str => Str ,
339
- Array ( t, c) => Array ( t. clone ( ) , c. clone ( ) ) ,
340
- Slice ( t) => Slice ( t. clone ( ) ) ,
341
- RawPtr ( p) => RawPtr ( p. clone ( ) ) ,
342
- Ref ( r, t, m) => Ref ( r. clone ( ) , t. clone ( ) , m. clone ( ) ) ,
343
- FnDef ( d, s) => FnDef ( d. clone ( ) , s. clone ( ) ) ,
344
- FnPtr ( s) => FnPtr ( s. clone ( ) ) ,
345
- Dynamic ( p, r, repr) => Dynamic ( p. clone ( ) , r. clone ( ) , * repr) ,
346
- Closure ( d, s) => Closure ( d. clone ( ) , s. clone ( ) ) ,
347
- Coroutine ( d, s, m) => Coroutine ( d. clone ( ) , s. clone ( ) , m. clone ( ) ) ,
348
- CoroutineWitness ( d, s) => CoroutineWitness ( d. clone ( ) , s. clone ( ) ) ,
349
- Never => Never ,
350
- Tuple ( t) => Tuple ( t. clone ( ) ) ,
351
- Alias ( k, p) => Alias ( * k, p. clone ( ) ) ,
352
- Param ( p) => Param ( p. clone ( ) ) ,
353
- Bound ( d, b) => Bound ( * d, b. clone ( ) ) ,
354
- Placeholder ( p) => Placeholder ( p. clone ( ) ) ,
355
- Infer ( t) => Infer ( t. clone ( ) ) ,
356
- Error ( e) => Error ( e. clone ( ) ) ,
357
- }
358
- }
359
- }
360
-
361
329
// This is manually implemented because a derive would require `I: PartialEq`
362
330
impl < I : Interner > PartialEq for TyKind < I > {
363
331
#[ inline]
@@ -614,6 +582,7 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
614
582
}
615
583
}
616
584
}
585
+
617
586
// This is manually implemented because a derive would require `I: Debug`
618
587
impl < I : Interner > fmt:: Debug for TyKind < I > {
619
588
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
0 commit comments