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

Implement match ergonomics 2024 #122978

Closed
wants to merge 5 commits into from

Conversation

Jules-Bertholet
Copy link
Contributor

@Jules-Bertholet Jules-Bertholet commented Mar 24, 2024

Implement changes to match ergonomics for the 2024 edition, as described in #105647, #64586, https://hackmd.io/YLKslGwpQOeAyGBayO9mdw.

  • mut ref/mut ref mut
    • Bikeshed
    • Update all pattern diagnostics to ensure they know about this
  • Changes to & and &mut patterns
    • The HackMD says the reference types should be "compatible", not sure what that means so in the current impl they must match exactly
  • Don't reset binding mode on mut with edition >= 2024
    • Edition migration lint
      • Rustfix
  • Feature gating
  • Documentation
  • FCP (RFC?)

Continuation of #120095. @Nadrieril

@rustbot label T-lang A-edition-2024 A-patterns

@rustbot
Copy link
Collaborator

rustbot commented Mar 24, 2024

r? @Nadrieril

rustbot has assigned @Nadrieril.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-edition-2024 Area: The 2024 edition A-patterns Relating to patterns and pattern matching S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-lang Relevant to the language team, which will review and decide on the PR/issue. labels Mar 24, 2024
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Nadrieril
Copy link
Member

Wow, thank you for taking over this! Let me know when you'd like me to have a look.

@Jules-Bertholet
Copy link
Contributor Author

@Nadrieril this should be ready for an initial review

@rustbot label -S-waiting-on-author

@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 25, 2024
@Jules-Bertholet Jules-Bertholet changed the title [WIP] Implement match ergonomics 2024 Implement match ergonomics 2024 Mar 25, 2024
@Jules-Bertholet Jules-Bertholet force-pushed the match-2024 branch 2 times, most recently from fee5782 to 52f4f99 Compare March 25, 2024 02:20
@bors
Copy link
Contributor

bors commented Mar 25, 2024

☔ The latest upstream changes (presumably #122721) made this pull request unmergeable. Please resolve the merge conflicts.

Nadrieril and others added 5 commits March 25, 2024 00:34
The original proposal allows reference patterns
with "compatible" mutability, however it's not clear
what that means so for now we require an exact match.

I don't know the type system code well, so if something
seems to not make sense it's probably because I made a
mistake
Leads to bad results when combined with
machine-applicable error fixes;
not sure if that is considered acceptable.

Again, I don't know what I am doing
wrt type system stuff so needs more review there
@WaffleLapkin
Copy link
Member

This groups together multiple mostly unrelated changes. Could you split them into separate PRs? This will make review, discussion, FCPs, etc easier.

@Jules-Bertholet
Copy link
Contributor Author

Jules-Bertholet commented Mar 26, 2024

@WaffleLapkin The changes are related, as the edition migration lint for the change to mut ident relies on all the other features in order to produce valid code. So if I split this up, the edition change PR will be blocked on the other two.

@WaffleLapkin
Copy link
Member

WaffleLapkin commented Mar 26, 2024

So if I split this up, the edition change PR will be blocked on the other two.

That seems fine?...

Like, if everything is in the same PR, everything in it is blocked on everything else (in my expirience big PRs require exponentially-ish more time, multiple small PRs are almost always faster merged).

Also, the edition migration is what's blocked (I think we can merge the implementation before the migration? seems fine as long as we don't forget to merge the migration later).

@Jules-Bertholet
Copy link
Contributor Author

Closing in favor of separate PRs.
Tracking issue: #123076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-edition-2024 Area: The 2024 edition A-patterns Relating to patterns and pattern matching S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants