Registry Mirror
Skip to content

Conversation

@smalis-msft

@smalis-msft Steven Malis (smalis-msft) commented Dec 18, 2024 •

Copy link
Copy Markdown
Contributor

The Rust 2024 edition will be changing how impl Trait in return position functions. Namely it will be changing the rules from capturing no lifetimes, to capturing all lifetimes. The reasons for this are documented in RFC 3498 and the migration guide. A new 'precise capturing' syntax has been added to allow cases that don't need everything captured to scope down what they take. This PR updates all such cases to use the new syntax.

Note that currently this new syntax requires all type parameters in scope to be listed. This currently results in overcapturing of type parameters. This will be relaxed in the future, and is tracked by RFC 3617.

This PR also marks the edition_2024_expr_fragment_specifier lint as no longer needing fixing, as I have completed an audit of all our macros that it flagged and none of them need changing.

Part of #288

@smalis-msft Steven Malis (smalis-msft) changed the title Fixup impl trait overcapturing for the 2024 edition Fixup return position impl trait overcapturing for the 2024 edition Dec 18, 2024
@smalis-msft
Steven Malis (smalis-msft) marked this pull request as draft December 18, 2024 20:17

@daprilik Daniel Prilik (daprilik) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems fine to me. The extra verbosity is unfortunate, but given the scope of our codebase, and the fact that it only came up a total of - *checks notes* - ~23 times implies to me that its prob not gonna be a major annoyance moving forwards.

@smalis-msft

Copy link
Copy Markdown
Contributor Author

Yeah, all my gripes here are language concerns, not codebase ones.

@smalis-msft
Steven Malis (smalis-msft) marked this pull request as ready for review January 14, 2025 16:53
@smalis-msft
Steven Malis (smalis-msft) merged commit 6375461 into microsoft:main Jan 14, 2025
@smalis-msft
Steven Malis (smalis-msft) deleted the impl-trait-overcaptures branch January 14, 2025 18:04
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