Repository: rust
Issue: Tracking Issue for match ergonomics 2024 (RFC 3627)
Labels: B-RFC-approved,T-lang,C-tracking-issue,A-patterns

This is a tracking issue for changes to match ergonomics for the 2024 edition, as described in https://github.com/rust-lang/rfcs/pull/3627.

### About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however *not* meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

### Steps

- [x] `mut ref`/`mut ref mut` (`#![feature(mut_ref)]`) #123080
  - [ ] Bikeshed (`ref (mut`/`ref mut (mut`?)
  - [ ] Update all pattern diagnostics to ensure they know about this
- [x] Changes to `&` and `&mut` patterns (`#![feature(ref_pat_eat_one_layer_2024, ref_pat_eat_one_layer_2024_structural)]`) #123512
- [x] Allow `&` patterns to consume `&mut` references https://github.com/rust-lang/rust/pull/124567
- [x] Don't reset binding mode on `mut` with edition >= 2024 #123535
  - [x] Edition migration lint (without rustfix)
- [x] Rustfix #124639
- [x] RFC https://github.com/rust-lang/rfcs/pull/3627
  - Original design doc: https://hackmd.io/YLKslGwpQOeAyGBayO9mdw.
- N/A: Add documentation to the [dev guide][].
    - See the [instructions][doc-guide].
- [x] Stabilize *Rule 1C*, *Rule 2C* for Rust 2024.
    - https://github.com/rust-lang/rust/pull/131381
- [ ] Stabilize *Rules 3-5* for all editions.
- [ ] Add documentation to the [reference][].
    - See the [instructions][reference-instructions].
- [ ] Add documentation to the [edition guide][].
- [ ] Ensure ready for Rust 2024 stabilization.

[dev guide]: https://github.com/rust-lang/rustc-dev-guide
[doc-guide]: https://rustc-dev-guide.rust-lang.org/stabilization_guide.html#documentation-prs
[edition guide]: https://github.com/rust-lang/edition-guide
[nightly style procedure]: https://github.com/rust-lang/style-team/blob/master/nightly-style-procedure.md
[reference]: https://github.com/rust-lang/reference
[reference-instructions]: https://github.com/rust-lang/reference/blob/master/CONTRIBUTING.md
[style guide]: https://github.com/rust-lang/rust/tree/master/src/doc/style-guide

Tracking for Rust 2024 changes:

- https://github.com/rust-lang/rust/issues/131414

### Unresolved Questions

- `mut ref mut` vs `ref mut (mut` syntax
-  The HackMD says the reference types should be "compatible", what does this mean and why?

```[tasklist]
### Implementation history
- [ ] https://github.com/rust-lang/rust/pull/122978
- [ ] https://github.com/rust-lang/rust/pull/123080
- [ ] https://github.com/rust-lang/rust/pull/123311
- [ ] https://github.com/rust-lang/rust/pull/123512
- [ ] https://github.com/rust-lang/rust/pull/123535
- [ ] https://github.com/rust-lang/rust/pull/124047
- [ ] https://github.com/rust-lang/rust/pull/124567
- [ ] https://github.com/rust-lang/rust/pull/124639
- [ ] https://github.com/rust-lang/rfcs/pull/3627
- [ ] https://github.com/rust-lang/rust/issues/125058
- [ ] https://github.com/rust-lang/rust/pull/125084
- [ ] https://github.com/rust-lang/rust/pull/125168
- [ ] https://github.com/rust-lang/rust/pull/127008
- [ ] https://github.com/rust-lang/rust/issues/127257
- [ ] https://github.com/rust-lang/rust/pull/127369
- [ ] https://github.com/rust-lang/rust/issues/127559
- [ ] https://github.com/rust-lang/rust/pull/135237
```

See also #105647, #64586


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