Skip to content

Conversation

JakobDegen
Copy link
Contributor

I'd like to write something like this:

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.

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.
Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@dtolnay dtolnay merged commit f1612cc into dtolnay:master Apr 26, 2025
19 checks passed
@dtolnay
Copy link
Owner

dtolnay commented Apr 26, 2025

Published in 2.0.101.

@JakobDegen JakobDegen deleted the turbofish branch April 26, 2025 20:11
facebook-github-bot pushed a commit to facebook/buck2 that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebook/dotslash that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebook/pyrefly that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebookincubator/reindeer that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebook/ocamlrep that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebookexperimental/rust-shed that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebook/buck2-shims-meta that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
facebook-github-bot pushed a commit to facebook/hhvm that referenced this pull request Apr 27, 2025
Summary: Pick up dtolnay/syn#1861

Reviewed By: dtolnay

Differential Revision: D73726005

fbshipit-source-id: aca81e034ceb0feb522d23a334aad4761c04a6e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants