@@ -114,6 +114,8 @@ pub enum AliasKind {
114114/// Types written by the user start out as `hir::TyKind` and get
115115/// converted to this representation using `AstConv::ast_ty_to_ty`.
116116#[ rustc_diagnostic_item = "IrTyKind" ]
117+ #[ derive( derivative:: Derivative ) ]
118+ #[ derivative( Clone ( bound = "" ) ) ]
117119pub enum TyKind < I : Interner > {
118120 /// The primitive boolean type. Written as `bool`.
119121 Bool ,
@@ -324,40 +326,6 @@ const fn tykind_discriminant<I: Interner>(value: &TyKind<I>) -> usize {
324326 }
325327}
326328
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-
361329// This is manually implemented because a derive would require `I: PartialEq`
362330impl < I : Interner > PartialEq for TyKind < I > {
363331 #[ inline]
@@ -614,6 +582,7 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
614582 }
615583 }
616584}
585+
617586// This is manually implemented because a derive would require `I: Debug`
618587impl < I : Interner > fmt:: Debug for TyKind < I > {
619588 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
0 commit comments