Skip to content

Commit 77e9051

Browse files
committed
Improve the pattern migration 2024 migration lint's message
1 parent 70b8527 commit 77e9051

File tree

6 files changed

+63
-63
lines changed

6 files changed

+63
-63
lines changed

compiler/rustc_mir_build/messages.ftl

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ mir_build_pointer_pattern = function pointers and raw pointers not derived from
285285
286286
mir_build_privately_uninhabited = pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
287287
288-
mir_build_rust_2024_incompatible_pat = pattern uses features incompatible with edition 2024
288+
mir_build_rust_2024_incompatible_pat = this pattern relies on behavior which may change in edition 2024
289289
290290
mir_build_rustc_box_attribute_error = `#[rustc_box]` attribute used incorrectly
291291
.attributes = no other attributes may be applied

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ fn main() {
2323
assert_type_eq(x, &mut 0u8);
2424

2525
let &Foo(mut x) = &Foo(0);
26-
//~^ ERROR: pattern uses features incompatible with edition 2024
26+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
2727
//~| WARN: this changes meaning in Rust 2024
2828
assert_type_eq(x, 0u8);
2929

3030
let &mut Foo(mut x) = &mut Foo(0);
31-
//~^ ERROR: pattern uses features incompatible with edition 2024
31+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
3232
//~| WARN: this changes meaning in Rust 2024
3333
assert_type_eq(x, 0u8);
3434

3535
let &Foo(ref x) = &Foo(0);
36-
//~^ ERROR: pattern uses features incompatible with edition 2024
36+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
3737
//~| WARN: this changes meaning in Rust 2024
3838
assert_type_eq(x, &0u8);
3939

4040
let &mut Foo(ref x) = &mut Foo(0);
41-
//~^ ERROR: pattern uses features incompatible with edition 2024
41+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
4242
//~| WARN: this changes meaning in Rust 2024
4343
assert_type_eq(x, &0u8);
4444

@@ -55,22 +55,22 @@ fn main() {
5555
assert_type_eq(x, &0u8);
5656

5757
let &Foo(&x) = &Foo(&0);
58-
//~^ ERROR: pattern uses features incompatible with edition 2024
58+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
5959
//~| WARN: this changes meaning in Rust 2024
6060
assert_type_eq(x, 0u8);
6161

6262
let &Foo(&mut x) = &Foo(&mut 0);
63-
//~^ ERROR: pattern uses features incompatible with edition 2024
63+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
6464
//~| WARN: this changes meaning in Rust 2024
6565
assert_type_eq(x, 0u8);
6666

6767
let &mut Foo(&x) = &mut Foo(&0);
68-
//~^ ERROR: pattern uses features incompatible with edition 2024
68+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
6969
//~| WARN: this changes meaning in Rust 2024
7070
assert_type_eq(x, 0u8);
7171

7272
let &mut Foo(&mut x) = &mut Foo(&mut 0);
73-
//~^ ERROR: pattern uses features incompatible with edition 2024
73+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
7474
//~| WARN: this changes meaning in Rust 2024
7575
assert_type_eq(x, 0u8);
7676

@@ -79,25 +79,25 @@ fn main() {
7979
}
8080

8181
if let &&&&&Some(&x) = &&&&&Some(&0u8) {
82-
//~^ ERROR: pattern uses features incompatible with edition 2024
82+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
8383
//~| WARN: this changes meaning in Rust 2024
8484
assert_type_eq(x, 0u8);
8585
}
8686

8787
if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) {
88-
//~^ ERROR: pattern uses features incompatible with edition 2024
88+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
8989
//~| WARN: this changes meaning in Rust 2024
9090
assert_type_eq(x, 0u8);
9191
}
9292

9393
if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) {
94-
//~^ ERROR: pattern uses features incompatible with edition 2024
94+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
9595
//~| WARN: this changes meaning in Rust 2024
9696
assert_type_eq(x, 0u8);
9797
}
9898

9999
if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
100-
//~^ ERROR: pattern uses features incompatible with edition 2024
100+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
101101
//~| WARN: this changes meaning in Rust 2024
102102
assert_type_eq(x, &mut 0u8);
103103
}
@@ -109,20 +109,20 @@ fn main() {
109109
}
110110

111111
let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
112-
//~^ ERROR: pattern uses features incompatible with edition 2024
112+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
113113
//~| WARN: this changes meaning in Rust 2024
114114
assert_type_eq(a, &0u32);
115115
assert_type_eq(b, 0u32);
116116

117117
let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
118-
//~^ ERROR: pattern uses features incompatible with edition 2024
118+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
119119
//~| WARN: this changes meaning in Rust 2024
120120
assert_type_eq(a, 0u32);
121121
assert_type_eq(b, &&0u32);
122122
assert_type_eq(c, &&0u32);
123123

124124
if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
125-
//~^ ERROR: pattern uses features incompatible with edition 2024
125+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
126126
//~| WARN: this changes meaning in Rust 2024
127127
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
128128
{
@@ -135,7 +135,7 @@ fn main() {
135135
// The two patterns are the same syntactically, but because they're defined in different
136136
// editions they don't mean the same thing.
137137
&(Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {
138-
//~^ ERROR: pattern uses features incompatible with edition 2024
138+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
139139
assert_type_eq(x, 0u32);
140140
assert_type_eq(y, 0u32);
141141
}

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,22 @@ fn main() {
2323
assert_type_eq(x, &mut 0u8);
2424

2525
let Foo(mut x) = &Foo(0);
26-
//~^ ERROR: pattern uses features incompatible with edition 2024
26+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
2727
//~| WARN: this changes meaning in Rust 2024
2828
assert_type_eq(x, 0u8);
2929

3030
let Foo(mut x) = &mut Foo(0);
31-
//~^ ERROR: pattern uses features incompatible with edition 2024
31+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
3232
//~| WARN: this changes meaning in Rust 2024
3333
assert_type_eq(x, 0u8);
3434

3535
let Foo(ref x) = &Foo(0);
36-
//~^ ERROR: pattern uses features incompatible with edition 2024
36+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
3737
//~| WARN: this changes meaning in Rust 2024
3838
assert_type_eq(x, &0u8);
3939

4040
let Foo(ref x) = &mut Foo(0);
41-
//~^ ERROR: pattern uses features incompatible with edition 2024
41+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
4242
//~| WARN: this changes meaning in Rust 2024
4343
assert_type_eq(x, &0u8);
4444

@@ -55,22 +55,22 @@ fn main() {
5555
assert_type_eq(x, &0u8);
5656

5757
let Foo(&x) = &Foo(&0);
58-
//~^ ERROR: pattern uses features incompatible with edition 2024
58+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
5959
//~| WARN: this changes meaning in Rust 2024
6060
assert_type_eq(x, 0u8);
6161

6262
let Foo(&mut x) = &Foo(&mut 0);
63-
//~^ ERROR: pattern uses features incompatible with edition 2024
63+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
6464
//~| WARN: this changes meaning in Rust 2024
6565
assert_type_eq(x, 0u8);
6666

6767
let Foo(&x) = &mut Foo(&0);
68-
//~^ ERROR: pattern uses features incompatible with edition 2024
68+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
6969
//~| WARN: this changes meaning in Rust 2024
7070
assert_type_eq(x, 0u8);
7171

7272
let Foo(&mut x) = &mut Foo(&mut 0);
73-
//~^ ERROR: pattern uses features incompatible with edition 2024
73+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
7474
//~| WARN: this changes meaning in Rust 2024
7575
assert_type_eq(x, 0u8);
7676

@@ -79,25 +79,25 @@ fn main() {
7979
}
8080

8181
if let Some(&x) = &&&&&Some(&0u8) {
82-
//~^ ERROR: pattern uses features incompatible with edition 2024
82+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
8383
//~| WARN: this changes meaning in Rust 2024
8484
assert_type_eq(x, 0u8);
8585
}
8686

8787
if let Some(&mut x) = &&&&&Some(&mut 0u8) {
88-
//~^ ERROR: pattern uses features incompatible with edition 2024
88+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
8989
//~| WARN: this changes meaning in Rust 2024
9090
assert_type_eq(x, 0u8);
9191
}
9292

9393
if let Some(&x) = &&&&&mut Some(&0u8) {
94-
//~^ ERROR: pattern uses features incompatible with edition 2024
94+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
9595
//~| WARN: this changes meaning in Rust 2024
9696
assert_type_eq(x, 0u8);
9797
}
9898

9999
if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
100-
//~^ ERROR: pattern uses features incompatible with edition 2024
100+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
101101
//~| WARN: this changes meaning in Rust 2024
102102
assert_type_eq(x, &mut 0u8);
103103
}
@@ -109,20 +109,20 @@ fn main() {
109109
}
110110

111111
let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
112-
//~^ ERROR: pattern uses features incompatible with edition 2024
112+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
113113
//~| WARN: this changes meaning in Rust 2024
114114
assert_type_eq(a, &0u32);
115115
assert_type_eq(b, 0u32);
116116

117117
let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
118-
//~^ ERROR: pattern uses features incompatible with edition 2024
118+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
119119
//~| WARN: this changes meaning in Rust 2024
120120
assert_type_eq(a, 0u32);
121121
assert_type_eq(b, &&0u32);
122122
assert_type_eq(c, &&0u32);
123123

124124
if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
125-
//~^ ERROR: pattern uses features incompatible with edition 2024
125+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
126126
//~| WARN: this changes meaning in Rust 2024
127127
&(Struct { a: &Some(&0), b: &Some(&0), c: &Some(&0) })
128128
{
@@ -135,7 +135,7 @@ fn main() {
135135
// The two patterns are the same syntactically, but because they're defined in different
136136
// editions they don't mean the same thing.
137137
(Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {
138-
//~^ ERROR: pattern uses features incompatible with edition 2024
138+
//~^ ERROR: this pattern relies on behavior which may change in edition 2024
139139
assert_type_eq(x, 0u32);
140140
assert_type_eq(y, 0u32);
141141
}

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

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: pattern uses features incompatible with edition 2024
1+
error: this pattern relies on behavior which may change in edition 2024
22
--> $DIR/migration_lint.rs:25:13
33
|
44
LL | let Foo(mut x) = &Foo(0);
@@ -16,7 +16,7 @@ help: make the implied reference pattern explicit
1616
LL | let &Foo(mut x) = &Foo(0);
1717
| +
1818

19-
error: pattern uses features incompatible with edition 2024
19+
error: this pattern relies on behavior which may change in edition 2024
2020
--> $DIR/migration_lint.rs:30:13
2121
|
2222
LL | let Foo(mut x) = &mut Foo(0);
@@ -29,7 +29,7 @@ help: make the implied reference pattern explicit
2929
LL | let &mut Foo(mut x) = &mut Foo(0);
3030
| ++++
3131

32-
error: pattern uses features incompatible with edition 2024
32+
error: this pattern relies on behavior which may change in edition 2024
3333
--> $DIR/migration_lint.rs:35:13
3434
|
3535
LL | let Foo(ref x) = &Foo(0);
@@ -42,7 +42,7 @@ help: make the implied reference pattern explicit
4242
LL | let &Foo(ref x) = &Foo(0);
4343
| +
4444

45-
error: pattern uses features incompatible with edition 2024
45+
error: this pattern relies on behavior which may change in edition 2024
4646
--> $DIR/migration_lint.rs:40:13
4747
|
4848
LL | let Foo(ref x) = &mut Foo(0);
@@ -55,7 +55,7 @@ help: make the implied reference pattern explicit
5555
LL | let &mut Foo(ref x) = &mut Foo(0);
5656
| ++++
5757

58-
error: pattern uses features incompatible with edition 2024
58+
error: this pattern relies on behavior which may change in edition 2024
5959
--> $DIR/migration_lint.rs:57:13
6060
|
6161
LL | let Foo(&x) = &Foo(&0);
@@ -68,7 +68,7 @@ help: make the implied reference pattern explicit
6868
LL | let &Foo(&x) = &Foo(&0);
6969
| +
7070

71-
error: pattern uses features incompatible with edition 2024
71+
error: this pattern relies on behavior which may change in edition 2024
7272
--> $DIR/migration_lint.rs:62:13
7373
|
7474
LL | let Foo(&mut x) = &Foo(&mut 0);
@@ -81,7 +81,7 @@ help: make the implied reference pattern explicit
8181
LL | let &Foo(&mut x) = &Foo(&mut 0);
8282
| +
8383

84-
error: pattern uses features incompatible with edition 2024
84+
error: this pattern relies on behavior which may change in edition 2024
8585
--> $DIR/migration_lint.rs:67:13
8686
|
8787
LL | let Foo(&x) = &mut Foo(&0);
@@ -94,7 +94,7 @@ help: make the implied reference pattern explicit
9494
LL | let &mut Foo(&x) = &mut Foo(&0);
9595
| ++++
9696

97-
error: pattern uses features incompatible with edition 2024
97+
error: this pattern relies on behavior which may change in edition 2024
9898
--> $DIR/migration_lint.rs:72:13
9999
|
100100
LL | let Foo(&mut x) = &mut Foo(&mut 0);
@@ -107,7 +107,7 @@ help: make the implied reference pattern explicit
107107
LL | let &mut Foo(&mut x) = &mut Foo(&mut 0);
108108
| ++++
109109

110-
error: pattern uses features incompatible with edition 2024
110+
error: this pattern relies on behavior which may change in edition 2024
111111
--> $DIR/migration_lint.rs:81:17
112112
|
113113
LL | if let Some(&x) = &&&&&Some(&0u8) {
@@ -120,7 +120,7 @@ help: make the implied reference patterns explicit
120120
LL | if let &&&&&Some(&x) = &&&&&Some(&0u8) {
121121
| +++++
122122

123-
error: pattern uses features incompatible with edition 2024
123+
error: this pattern relies on behavior which may change in edition 2024
124124
--> $DIR/migration_lint.rs:87:17
125125
|
126126
LL | if let Some(&mut x) = &&&&&Some(&mut 0u8) {
@@ -133,7 +133,7 @@ help: make the implied reference patterns explicit
133133
LL | if let &&&&&Some(&mut x) = &&&&&Some(&mut 0u8) {
134134
| +++++
135135

136-
error: pattern uses features incompatible with edition 2024
136+
error: this pattern relies on behavior which may change in edition 2024
137137
--> $DIR/migration_lint.rs:93:17
138138
|
139139
LL | if let Some(&x) = &&&&&mut Some(&0u8) {
@@ -146,7 +146,7 @@ help: make the implied reference patterns explicit
146146
LL | if let &&&&&mut Some(&x) = &&&&&mut Some(&0u8) {
147147
| ++++++++
148148

149-
error: pattern uses features incompatible with edition 2024
149+
error: this pattern relies on behavior which may change in edition 2024
150150
--> $DIR/migration_lint.rs:99:17
151151
|
152152
LL | if let Some(&mut Some(Some(x))) = &mut Some(&mut Some(&mut Some(0u8))) {
@@ -159,7 +159,7 @@ help: make the implied reference patterns and variable binding mode explicit
159159
LL | if let &mut Some(&mut Some(&mut Some(ref mut x))) = &mut Some(&mut Some(&mut Some(0u8))) {
160160
| ++++ ++++ +++++++
161161

162-
error: pattern uses features incompatible with edition 2024
162+
error: this pattern relies on behavior which may change in edition 2024
163163
--> $DIR/migration_lint.rs:111:21
164164
|
165165
LL | let Struct { a, mut b, c } = &Struct { a: 0, b: 0, c: 0 };
@@ -172,7 +172,7 @@ help: make the implied reference pattern and variable binding modes explicit
172172
LL | let &Struct { ref a, mut b, ref c } = &Struct { a: 0, b: 0, c: 0 };
173173
| + +++ +++
174174

175-
error: pattern uses features incompatible with edition 2024
175+
error: this pattern relies on behavior which may change in edition 2024
176176
--> $DIR/migration_lint.rs:117:21
177177
|
178178
LL | let Struct { a: &a, b, ref c } = &Struct { a: &0, b: &0, c: &0 };
@@ -187,7 +187,7 @@ help: make the implied reference pattern and variable binding mode explicit
187187
LL | let &Struct { a: &a, ref b, ref c } = &Struct { a: &0, b: &0, c: &0 };
188188
| + +++
189189

190-
error: pattern uses features incompatible with edition 2024
190+
error: this pattern relies on behavior which may change in edition 2024
191191
--> $DIR/migration_lint.rs:124:24
192192
|
193193
LL | if let Struct { a: &Some(a), b: Some(&b), c: Some(c) } =
@@ -202,7 +202,7 @@ help: make the implied reference patterns and variable binding mode explicit
202202
LL | if let &Struct { a: &Some(a), b: &Some(&b), c: &Some(ref c) } =
203203
| + + + +++
204204

205-
error: pattern uses features incompatible with edition 2024
205+
error: this pattern relies on behavior which may change in edition 2024
206206
--> $DIR/migration_lint.rs:137:15
207207
|
208208
LL | (Some(mut x), migration_lint_macros::mixed_edition_pat!(y)) => {

0 commit comments

Comments
 (0)