@@ -311,7 +311,32 @@ fn handle_item_impl(mut item: ItemImpl) -> TokenStream {
311
311
generics : Generics {
312
312
lt_token : Some ( Token ! ( <) ( Span :: call_site ( ) ) ) ,
313
313
gt_token : Some ( Token ! ( >) ( Span :: call_site ( ) ) ) ,
314
- where_clause : None ,
314
+ where_clause : Some ( WhereClause {
315
+ where_token : Where :: default ( ) ,
316
+ predicates : function_lifetimes
317
+ . iter ( )
318
+ . cloned ( )
319
+ . map ( |lifetimedef| {
320
+ WherePredicate :: Type ( PredicateType {
321
+ colon_token : Token ! ( : ) ( Span :: call_site ( ) ) ,
322
+ lifetimes : None ,
323
+ bounded_ty : Type :: Path ( TypePath {
324
+ qself : None ,
325
+ path : Path {
326
+ leading_colon : None ,
327
+ segments : Punctuated :: from_iter ( [ PathSegment {
328
+ ident : Ident :: new ( "Self" , Span :: call_site ( ) ) ,
329
+ arguments : PathArguments :: None ,
330
+ } ] ) ,
331
+ } ,
332
+ } ) ,
333
+ bounds : Punctuated :: from_iter ( [ TypeParamBound :: Lifetime (
334
+ lifetimedef. lifetime ,
335
+ ) ] ) ,
336
+ } )
337
+ } )
338
+ . collect ( ) ,
339
+ } ) ,
315
340
params : function_lifetimes
316
341
. iter ( )
317
342
. cloned ( )
@@ -590,7 +615,32 @@ fn handle_item_trait(mut item: ItemTrait) -> TokenStream {
590
615
generics : Generics {
591
616
lt_token : Some ( Token ! ( <) ( Span :: call_site ( ) ) ) ,
592
617
gt_token : Some ( Token ! ( >) ( Span :: call_site ( ) ) ) ,
593
- where_clause : None ,
618
+ where_clause : Some ( WhereClause {
619
+ where_token : Where :: default ( ) ,
620
+ predicates : function_lifetimes
621
+ . iter ( )
622
+ . cloned ( )
623
+ . map ( |lifetimedef| {
624
+ WherePredicate :: Type ( PredicateType {
625
+ colon_token : Token ! ( : ) ( Span :: call_site ( ) ) ,
626
+ lifetimes : None ,
627
+ bounded_ty : Type :: Path ( TypePath {
628
+ qself : None ,
629
+ path : Path {
630
+ leading_colon : None ,
631
+ segments : Punctuated :: from_iter ( [ PathSegment {
632
+ ident : Ident :: new ( "Self" , Span :: call_site ( ) ) ,
633
+ arguments : PathArguments :: None ,
634
+ } ] ) ,
635
+ } ,
636
+ } ) ,
637
+ bounds : Punctuated :: from_iter ( [ TypeParamBound :: Lifetime (
638
+ lifetimedef. lifetime ,
639
+ ) ] ) ,
640
+ } )
641
+ } )
642
+ . collect ( ) ,
643
+ } ) ,
594
644
params : function_lifetimes
595
645
. iter ( )
596
646
. cloned ( )
0 commit comments