You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reword pattern migration diagnostic to make sense in all editions
This aligns the main error message a bit more with the phrasing in the
Edition Guide and provides a bit more information on the labels to
(hopefully!) aid in understanding.
Copy file name to clipboardExpand all lines: compiler/rustc_mir_build/messages.ftl
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -285,7 +285,16 @@ mir_build_pointer_pattern = function pointers and raw pointers not derived from
285
285
286
286
mir_build_privately_uninhabited = pattern `{$witness_1}` is currently uninhabited, but this variant contains private fields which may become inhabited in the future
287
287
288
-
mir_build_rust_2024_incompatible_pat = this pattern relies on behavior which may change in edition 2024
Copy file name to clipboardExpand all lines: tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
error[E0308]: mismatched types
2
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:60:10
2
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:54:10
3
3
|
4
4
LL | let [&mut ref x] = &[&mut 0];
5
5
| ^^^^^
@@ -10,11 +10,11 @@ help: replace this `&mut` pattern with `&`
10
10
LL | let [&ref x] = &[&mut 0];
11
11
| ~
12
12
13
-
error: this pattern relies on behavior which may change in edition 2024
14
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:74:10
13
+
error: binding modifiers may only be written when the default binding mode is `move`
14
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
15
15
|
16
16
LL | let [ref mut x] = &[0];
17
-
| ^^^^^^^ cannot override to bind by-reference when that is the implicit default
17
+
| ^^^^^^^ default binding mode is `ref`
18
18
|
19
19
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
20
20
help: make the implied reference pattern explicit
@@ -23,40 +23,40 @@ LL | let &[ref mut x] = &[0];
23
23
| +
24
24
25
25
error[E0596]: cannot borrow data in a `&` reference as mutable
26
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:74:10
26
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
27
27
|
28
28
LL | let [ref mut x] = &[0];
29
29
| ^^^^^^^^^ cannot borrow as mutable
30
30
31
-
error: this pattern relies on behavior which may change in edition 2024
32
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:83:10
31
+
error: binding modifiers may only be written when the default binding mode is `move`
32
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:75:10
33
33
|
34
34
LL | let [ref x] = &[0];
35
-
| ^^^ cannot override to bind by-reference when that is the implicit default
35
+
| ^^^ default binding mode is `ref`
36
36
|
37
37
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
38
38
help: make the implied reference pattern explicit
39
39
|
40
40
LL | let &[ref x] = &[0];
41
41
| +
42
42
43
-
error: this pattern relies on behavior which may change in edition 2024
44
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:88:10
43
+
error: binding modifiers may only be written when the default binding mode is `move`
44
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:79:10
45
45
|
46
46
LL | let [ref x] = &mut [0];
47
-
| ^^^ cannot override to bind by-reference when that is the implicit default
47
+
| ^^^ default binding mode is `ref mut`
48
48
|
49
49
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
50
50
help: make the implied reference pattern explicit
51
51
|
52
52
LL | let &mut [ref x] = &mut [0];
53
53
| ++++
54
54
55
-
error: this pattern relies on behavior which may change in edition 2024
56
-
--> $DIR/ref-binding-on-inh-ref-errors.rs:93:10
55
+
error: binding modifiers may only be written when the default binding mode is `move`
56
+
--> $DIR/ref-binding-on-inh-ref-errors.rs:83:10
57
57
|
58
58
LL | let [ref mut x] = &mut [0];
59
-
| ^^^^^^^ cannot override to bind by-reference when that is the implicit default
59
+
| ^^^^^^^ default binding mode is `ref mut`
60
60
|
61
61
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
0 commit comments