Skip to content

Commit 4eb014a

Browse files
committed
Apply fix from CyberSaxosTiGER
1 parent dc2b7e8 commit 4eb014a

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

src/lib.rs

+52-2
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,32 @@ fn handle_item_impl(mut item: ItemImpl) -> TokenStream {
311311
generics: Generics {
312312
lt_token: Some(Token!(<)(Span::call_site())),
313313
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+
}),
315340
params: function_lifetimes
316341
.iter()
317342
.cloned()
@@ -590,7 +615,32 @@ fn handle_item_trait(mut item: ItemTrait) -> TokenStream {
590615
generics: Generics {
591616
lt_token: Some(Token!(<)(Span::call_site())),
592617
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+
}),
594644
params: function_lifetimes
595645
.iter()
596646
.cloned()

0 commit comments

Comments
 (0)