@@ -388,7 +388,7 @@ impl<'a> TraitDef<'a> {
388
388
methods : Vec < P < ast:: Method > > ) -> P < ast:: Item > {
389
389
let trait_path = self . path . to_path ( cx, self . span , type_ident, generics) ;
390
390
391
- let Generics { mut lifetimes, ty_params, where_clause : _ } =
391
+ let Generics { mut lifetimes, ty_params, mut where_clause } =
392
392
self . generics . to_generics ( cx, self . span , type_ident, generics) ;
393
393
let mut ty_params = ty_params. into_vec ( ) ;
394
394
@@ -420,13 +420,33 @@ impl<'a> TraitDef<'a> {
420
420
ty_param. unbound . clone ( ) ,
421
421
None )
422
422
} ) ) ;
423
+
424
+ // and similarly for where clauses
425
+ where_clause. predicates . extend ( generics. where_clause . predicates . iter ( ) . map ( |clause| {
426
+ match * clause {
427
+ ast:: WherePredicate :: BoundPredicate ( ref wb) => {
428
+ ast:: WherePredicate :: BoundPredicate ( ast:: WhereBoundPredicate {
429
+ id : ast:: DUMMY_NODE_ID ,
430
+ span : self . span ,
431
+ ident : wb. ident ,
432
+ bounds : OwnedSlice :: from_vec ( wb. bounds . iter ( ) . map ( |b| b. clone ( ) ) . collect ( ) )
433
+ } )
434
+ }
435
+ ast:: WherePredicate :: EqPredicate ( ref we) => {
436
+ ast:: WherePredicate :: EqPredicate ( ast:: WhereEqPredicate {
437
+ id : ast:: DUMMY_NODE_ID ,
438
+ span : self . span ,
439
+ path : we. path . clone ( ) ,
440
+ ty : we. ty . clone ( )
441
+ } )
442
+ }
443
+ }
444
+ } ) ) ;
445
+
423
446
let trait_generics = Generics {
424
447
lifetimes : lifetimes,
425
448
ty_params : OwnedSlice :: from_vec ( ty_params) ,
426
- where_clause : ast:: WhereClause {
427
- id : ast:: DUMMY_NODE_ID ,
428
- predicates : Vec :: new ( ) ,
429
- } ,
449
+ where_clause : where_clause
430
450
} ;
431
451
432
452
// Create the reference to the trait.
0 commit comments