Skip to content

Conversation

@zachs18
Copy link
Contributor

@zachs18 zachs18 commented Jan 14, 2026

Tracking issue for mut_ref (and other parts of Match Ergonomics 2024): #123076

#123080 introduced mut ref1 patterns (for by-reference bindings where the binding itself is mutable), feature-gated behind the mut_ref feature, except for in struct pattern shorthand, where the feature gating was missing. Thus, mut ref patterns in struct pattern shorthand has been unintentionally stable for ~18 months (since 1.79.0 (compiler explorer)).

This PR adds feature-gating for mut ref patterns in struct pattern shorthand. Since this is reverting an accidental stabilization, this probably needs a crater run and a T-lang FCP?

Some alternative possibilities:

  • Do nothing (let the inconsistency exist until feature(mut_ref) is stabilized)
  • Document the existing behavior
  • Do a FCW instead of fully feature-gating
  • Stabilize feature(mut_ref)

CC #123080 (comment)

CC @Nadrieril

Footnotes

  1. everything in this description also applies analogously to mut ref mut patterns.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 14, 2026
@zachs18 zachs18 marked this pull request as ready for review January 14, 2026 06:31
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 14, 2026
@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 Jan 14, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2026

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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

@JonathanBrouwer
Copy link
Contributor

@bors try

rust-bors bot pushed a commit that referenced this pull request Jan 14, 2026
…ate, r=<try>

Feature-gate `mut ref` patterns in struct pattern field shorthand
@rust-bors

This comment has been minimized.

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 14, 2026

☀️ Try build successful (CI)
Build commit: 50d7e48 (50d7e48beb74b48bd17c3749bfb73843c9ae0166, parent: fcac501a73cdde54de46a0683567f1a890730555)

@fmease
Copy link
Member

fmease commented Jan 14, 2026

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-151102 created and queued.
🤖 Automatically detected try build 50d7e48
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-crater Status: Waiting on a crater run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants