Skip to content

Commit d04eea1

Browse files
committed
Fix lifetime on as_turbofish
I'd like to write something like this: ```rust struct W(syn::Generics); impl W { pub fn as_turbofish(&self) -> syn::Turbofish<'_> { self.0.split_for_impl().1.as_turbofish() } } ``` Unfortunately, that doesn't compile today and as far as I can tell it's completely unimplementable - the lifetime of the `syn::Turbofish` ends up tied to the temporary returned by `split_for_impl`. That seems silly and unintentional, fix it.
1 parent 432b303 commit d04eea1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ generics_wrapper_impls!(Turbofish);
344344
#[cfg(feature = "printing")]
345345
impl<'a> TypeGenerics<'a> {
346346
/// Turn a type's generics like `<X, Y>` into a turbofish like `::<X, Y>`.
347-
pub fn as_turbofish(&self) -> Turbofish {
347+
pub fn as_turbofish(&self) -> Turbofish<'a> {
348348
Turbofish(self.0)
349349
}
350350
}

0 commit comments

Comments
 (0)