Skip to content

Commit 4aaada4

Browse files
committed
Stabilize min_match_ergonomics_2024
1 parent 575033c commit 4aaada4

File tree

10 files changed

+104
-46
lines changed

10 files changed

+104
-46
lines changed

compiler/rustc_feature/src/unstable.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,9 +516,6 @@ declare_features! (
516516
(unstable, macro_metavar_expr_concat, "1.81.0", Some(124225)),
517517
/// Allows `#[marker]` on certain traits allowing overlapping implementations.
518518
(unstable, marker_trait_attr, "1.30.0", Some(29864)),
519-
/// A very restricted form of match ergonomics used over the 2024 edition transition to give
520-
/// more time for T-lang to decide the final form of RFC3627.
521-
(incomplete, min_match_ergonomics_2024, "CURRENT_RUSTC_VERSION", Some(123076)),
522519
/// A minimal, sound subset of specialization intended to be used by the
523520
/// standard library until the soundness issues with specialization
524521
/// are fixed.

compiler/rustc_lint_defs/src/builtin.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,6 @@ declare_lint! {
16501650
/// ### Example
16511651
///
16521652
/// ```rust,edition2021
1653-
/// #![feature(min_match_ergonomics_2024)]
16541653
/// #![warn(rust_2024_incompatible_pat)]
16551654
///
16561655
/// if let Some(&a) = &Some(&0u8) {
@@ -1671,12 +1670,10 @@ declare_lint! {
16711670
pub RUST_2024_INCOMPATIBLE_PAT,
16721671
Allow,
16731672
"detects patterns whose meaning will change in Rust 2024",
1674-
@feature_gate = min_match_ergonomics_2024;
1675-
// FIXME uncomment below upon stabilization
1676-
/*@future_incompatible = FutureIncompatibleInfo {
1673+
@future_incompatible = FutureIncompatibleInfo {
16771674
reason: FutureIncompatibilityReason::EditionSemanticsChange(Edition::Edition2024),
16781675
reference: "123076",
1679-
};*/
1676+
};
16801677
}
16811678

16821679
declare_lint! {

compiler/rustc_mir_build/src/thir/pattern/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub(super) fn pat_from_hir<'a, 'tcx>(
5757
let result = pcx.lower_pattern(pat);
5858
debug!("pat_from_hir({:?}) = {:?}", pat, result);
5959
if let Some(sugg) = pcx.rust_2024_migration_suggestion {
60-
if tcx.features().min_match_ergonomics_2024 && sugg.is_hard_error {
60+
if sugg.is_hard_error {
6161
let mut err = tcx.dcx().struct_span_err(
6262
pat.span,
6363
"patterns are not allowed to reset the default binding mode in rust 2024",

compiler/rustc_span/src/symbol.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1218,7 +1218,6 @@ symbols! {
12181218
min_const_generics,
12191219
min_const_unsafe_fn,
12201220
min_exhaustive_patterns,
1221-
min_match_ergonomics_2024,
12221221
min_specialization,
12231222
min_type_alias_impl_trait,
12241223
minnumf128,

tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.fixed

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ run-rustfix
33
//@ rustfix-only-machine-applicable
44
//@ aux-build:migration_lint_macros.rs
5-
#![feature(mut_ref, min_match_ergonomics_2024)]
5+
#![feature(mut_ref)]
66
#![allow(incomplete_features, unused)]
77
#![deny(rust_2024_incompatible_pat)]
88

@@ -24,18 +24,22 @@ fn main() {
2424

2525
let &Foo(mut x) = &Foo(0);
2626
//~^ ERROR: the semantics of this pattern will change in edition 2024
27+
//~| WARN: this changes meaning in Rust 2024
2728
assert_type_eq(x, 0u8);
2829

2930
let &mut Foo(mut x) = &mut Foo(0);
3031
//~^ ERROR: the semantics of this pattern will change in edition 2024
32+
//~| WARN: this changes meaning in Rust 2024
3133
assert_type_eq(x, 0u8);
3234

3335
let &Foo(ref x) = &Foo(0);
3436
//~^ ERROR: the semantics of this pattern will change in edition 2024
37+
//~| WARN: this changes meaning in Rust 2024
3538
assert_type_eq(x, &0u8);
3639

3740
let &mut Foo(ref x) = &mut Foo(0);
3841
//~^ ERROR: the semantics of this pattern will change in edition 2024
42+
//~| WARN: this changes meaning in Rust 2024
3943
assert_type_eq(x, &0u8);
4044

4145
let &Foo(x) = &Foo(0);
@@ -52,18 +56,22 @@ fn main() {
5256

5357
let &Foo(&x) = &Foo(&0);
5458
//~^ ERROR: the semantics of this pattern will change in edition 2024
59+
//~| WARN: this changes meaning in Rust 2024
5560
assert_type_eq(x, 0u8);
5661

5762
let &Foo(&mut x) = &Foo(&mut 0);
5863
//~^ ERROR: the semantics of this pattern will change in edition 2024
64+
//~| WARN: this changes meaning in Rust 2024
5965
assert_type_eq(x, 0u8);
6066

6167
let &mut Foo(&x) = &mut Foo(&0);
6268
//~^ ERROR: the semantics of this pattern will change in edition 2024
69+
//~| WARN: this changes meaning in Rust 2024
6370
assert_type_eq(x, 0u8);
6471

6572
let &mut Foo(&mut x) = &mut Foo(&mut 0);
6673
//~^ ERROR: the semantics of this pattern will change in edition 2024
74+
//~| WARN: this changes meaning in Rust 2024
6775
assert_type_eq(x, 0u8);
6876

6977
if let Some(x) = &&&&&Some(&0u8) {
@@ -72,21 +80,25 @@ fn main() {
7280

7381
if let &&&&&Some(&x) = &&&&&Some(&0u8) {
7482
//~^ ERROR: the semantics of this pattern will change in edition 2024
83+
//~| WARN: this changes meaning in Rust 2024
7584
assert_type_eq(x, 0u8);
7685
}
7786

7887
if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) {
7988
//~^ ERROR: the semantics of this pattern will change in edition 2024
89+
//~| WARN: this changes meaning in Rust 2024
8090
assert_type_eq(x, 0u8);
8191
}
8292

8393
if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) {
8494
//~^ ERROR: the semantics of this pattern will change in edition 2024
95+
//~| WARN: this changes meaning in Rust 2024
8596
assert_type_eq(x, 0u8);
8697
}
8798

8899
if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
89100
//~^ ERROR: the semantics of this pattern will change in edition 2024
101+
//~| WARN: this changes meaning in Rust 2024
90102
assert_type_eq(x, &mut 0u8);
91103
}
92104

@@ -98,17 +110,20 @@ fn main() {
98110

99111
let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
100112
//~^ ERROR: the semantics of this pattern will change in edition 2024
113+
//~| WARN: this changes meaning in Rust 2024
101114
assert_type_eq(a, &0u32);
102115
assert_type_eq(b, 0u32);
103116

104117
let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
105118
//~^ ERROR: the semantics of this pattern will change in edition 2024
119+
//~| WARN: this changes meaning in Rust 2024
106120
assert_type_eq(a, 0u32);
107121
assert_type_eq(b, &&0u32);
108122
assert_type_eq(c, &&0u32);
109123

110124
if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
111125
//~^ ERROR: the semantics of this pattern will change in edition 2024
126+
//~| WARN: this changes meaning in Rust 2024
112127
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
113128
{
114129
assert_type_eq(a, &0u32);

tests/ui/pattern/rfc-3627-match-ergonomics-2024/migration_lint.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//@ run-rustfix
33
//@ rustfix-only-machine-applicable
44
//@ aux-build:migration_lint_macros.rs
5-
#![feature(mut_ref, min_match_ergonomics_2024)]
5+
#![feature(mut_ref)]
66
#![allow(incomplete_features, unused)]
77
#![deny(rust_2024_incompatible_pat)]
88

@@ -24,18 +24,22 @@ fn main() {
2424

2525
let Foo(mut x) = &Foo(0);
2626
//~^ ERROR: the semantics of this pattern will change in edition 2024
27+
//~| WARN: this changes meaning in Rust 2024
2728
assert_type_eq(x, 0u8);
2829

2930
let Foo(mut x) = &mut Foo(0);
3031
//~^ ERROR: the semantics of this pattern will change in edition 2024
32+
//~| WARN: this changes meaning in Rust 2024
3133
assert_type_eq(x, 0u8);
3234

3335
let Foo(ref x) = &Foo(0);
3436
//~^ ERROR: the semantics of this pattern will change in edition 2024
37+
//~| WARN: this changes meaning in Rust 2024
3538
assert_type_eq(x, &0u8);
3639

3740
let Foo(ref x) = &mut Foo(0);
3841
//~^ ERROR: the semantics of this pattern will change in edition 2024
42+
//~| WARN: this changes meaning in Rust 2024
3943
assert_type_eq(x, &0u8);
4044

4145
let &Foo(x) = &Foo(0);
@@ -52,18 +56,22 @@ fn main() {
5256

5357
let Foo(&x) = &Foo(&0);
5458
//~^ ERROR: the semantics of this pattern will change in edition 2024
59+
//~| WARN: this changes meaning in Rust 2024
5560
assert_type_eq(x, 0u8);
5661

5762
let Foo(&mut x) = &Foo(&mut 0);
5863
//~^ ERROR: the semantics of this pattern will change in edition 2024
64+
//~| WARN: this changes meaning in Rust 2024
5965
assert_type_eq(x, 0u8);
6066

6167
let Foo(&x) = &mut Foo(&0);
6268
//~^ ERROR: the semantics of this pattern will change in edition 2024
69+
//~| WARN: this changes meaning in Rust 2024
6370
assert_type_eq(x, 0u8);
6471

6572
let Foo(&mut x) = &mut Foo(&mut 0);
6673
//~^ ERROR: the semantics of this pattern will change in edition 2024
74+
//~| WARN: this changes meaning in Rust 2024
6775
assert_type_eq(x, 0u8);
6876

6977
if let Some(x) = &&&&&Some(&0u8) {
@@ -72,21 +80,25 @@ fn main() {
7280

7381
if let Some(&x) = &&&&&Some(&0u8) {
7482
//~^ ERROR: the semantics of this pattern will change in edition 2024
83+
//~| WARN: this changes meaning in Rust 2024
7584
assert_type_eq(x, 0u8);
7685
}
7786

7887
if let Some(&mut x) = &&&&&Some(&mut 0u8) {
7988
//~^ ERROR: the semantics of this pattern will change in edition 2024
89+
//~| WARN: this changes meaning in Rust 2024
8090
assert_type_eq(x, 0u8);
8191
}
8292

8393
if let Some(&x) = &&&&&mut Some(&0u8) {
8494
//~^ ERROR: the semantics of this pattern will change in edition 2024
95+
//~| WARN: this changes meaning in Rust 2024
8596
assert_type_eq(x, 0u8);
8697
}
8798

8899
if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
89100
//~^ ERROR: the semantics of this pattern will change in edition 2024
101+
//~| WARN: this changes meaning in Rust 2024
90102
assert_type_eq(x, &mut 0u8);
91103
}
92104

@@ -98,17 +110,20 @@ fn main() {
98110

99111
let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
100112
//~^ ERROR: the semantics of this pattern will change in edition 2024
113+
//~| WARN: this changes meaning in Rust 2024
101114
assert_type_eq(a, &0u32);
102115
assert_type_eq(b, 0u32);
103116

104117
let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
105118
//~^ ERROR: the semantics of this pattern will change in edition 2024
119+
//~| WARN: this changes meaning in Rust 2024
106120
assert_type_eq(a, 0u32);
107121
assert_type_eq(b, &&0u32);
108122
assert_type_eq(c, &&0u32);
109123

110124
if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
111125
//~^ ERROR: the semantics of this pattern will change in edition 2024
126+
//~| WARN: this changes meaning in Rust 2024
112127
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
113128
{
114129
assert_type_eq(a, &0u32);

0 commit comments

Comments
 (0)