@@ -195,9 +195,6 @@ pub struct TraitDef<'a> {
195
195
/// other than the current trait
196
196
pub additional_bounds : Vec < Ty > ,
197
197
198
- /// Any extra lifetimes and/or bounds, e.g., `D: serialize::Decoder`
199
- pub generics : Bounds ,
200
-
201
198
/// Can this trait be derived for unions?
202
199
pub supports_unions : bool ,
203
200
@@ -581,19 +578,21 @@ impl<'a> TraitDef<'a> {
581
578
} )
582
579
} ) ;
583
580
584
- let Generics { mut params, mut where_clause, .. } =
585
- self . generics . to_generics ( cx, self . span , type_ident, generics) ;
581
+ let mut where_clause = ast:: WhereClause :: default ( ) ;
586
582
where_clause. span = generics. where_clause . span ;
587
583
let ctxt = self . span . ctxt ( ) ;
588
584
let span = generics. span . with_ctxt ( ctxt) ;
589
585
590
586
// Create the generic parameters
591
- params. extend ( generics. params . iter ( ) . map ( |param| match & param. kind {
592
- GenericParamKind :: Lifetime { .. } => param. clone ( ) ,
593
- GenericParamKind :: Type { .. } => {
594
- // I don't think this can be moved out of the loop, since
595
- // a GenericBound requires an ast id
596
- let bounds: Vec < _ > =
587
+ let params: Vec < _ > = generics
588
+ . params
589
+ . iter ( )
590
+ . map ( |param| match & param. kind {
591
+ GenericParamKind :: Lifetime { .. } => param. clone ( ) ,
592
+ GenericParamKind :: Type { .. } => {
593
+ // I don't think this can be moved out of the loop, since
594
+ // a GenericBound requires an ast id
595
+ let bounds: Vec < _ > =
597
596
// extra restrictions on the generics parameters to the
598
597
// type being derived upon
599
598
self . additional_bounds . iter ( ) . map ( |p| {
@@ -606,21 +605,22 @@ impl<'a> TraitDef<'a> {
606
605
param. bounds . iter ( ) . cloned ( )
607
606
) . collect ( ) ;
608
607
609
- cx. typaram ( param. ident . span . with_ctxt ( ctxt) , param. ident , bounds, None )
610
- }
611
- GenericParamKind :: Const { ty, kw_span, .. } => {
612
- let const_nodefault_kind = GenericParamKind :: Const {
613
- ty : ty. clone ( ) ,
614
- kw_span : kw_span. with_ctxt ( ctxt) ,
615
-
616
- // We can't have default values inside impl block
617
- default : None ,
618
- } ;
619
- let mut param_clone = param. clone ( ) ;
620
- param_clone. kind = const_nodefault_kind;
621
- param_clone
622
- }
623
- } ) ) ;
608
+ cx. typaram ( param. ident . span . with_ctxt ( ctxt) , param. ident , bounds, None )
609
+ }
610
+ GenericParamKind :: Const { ty, kw_span, .. } => {
611
+ let const_nodefault_kind = GenericParamKind :: Const {
612
+ ty : ty. clone ( ) ,
613
+ kw_span : kw_span. with_ctxt ( ctxt) ,
614
+
615
+ // We can't have default values inside impl block
616
+ default : None ,
617
+ } ;
618
+ let mut param_clone = param. clone ( ) ;
619
+ param_clone. kind = const_nodefault_kind;
620
+ param_clone
621
+ }
622
+ } )
623
+ . collect ( ) ;
624
624
625
625
// and similarly for where clauses
626
626
where_clause. predicates . extend ( generics. where_clause . predicates . iter ( ) . map ( |clause| {
0 commit comments