Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup return position impl trait overcapturing for the 2024 edition #528

Merged
merged 4 commits into from
Jan 14, 2025

Conversation

smalis-msft
Copy link
Contributor

@smalis-msft smalis-msft commented Dec 18, 2024

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 smalis-msft requested review from a team as code owners December 18, 2024 19:45
@smalis-msft 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 smalis-msft force-pushed the impl-trait-overcaptures branch from ff1000f to 7327636 Compare December 18, 2024 20:17
@smalis-msft smalis-msft marked this pull request as draft December 18, 2024 20:17
Copy link
Contributor

@daprilik daprilik left a comment

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
Contributor Author

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

@smalis-msft smalis-msft force-pushed the impl-trait-overcaptures branch from 7327636 to 1d1caae Compare January 14, 2025 16:53
@smalis-msft smalis-msft marked this pull request as ready for review January 14, 2025 16:53
@smalis-msft smalis-msft enabled auto-merge (squash) January 14, 2025 17:28
@smalis-msft smalis-msft merged commit 6375461 into microsoft:main Jan 14, 2025
25 checks passed
@smalis-msft 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