rust/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.classic2024.stderr
dianne bdc6c4d07b 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.
2025-02-03 01:50:14 -08:00

70 lines
2.4 KiB
Text

error[E0308]: mismatched types
--> $DIR/ref-binding-on-inh-ref-errors.rs:54:10
|
LL | let [&mut ref x] = &[&mut 0];
| ^^^^^
|
= note: cannot match inherited `&` with `&mut` pattern
help: replace this `&mut` pattern with `&`
|
LL | let [&ref x] = &[&mut 0];
| ~
error: binding modifiers may only be written when the default binding mode is `move`
--> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
|
LL | let [ref mut x] = &[0];
| ^^^^^^^ default binding mode is `ref`
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
help: make the implied reference pattern explicit
|
LL | let &[ref mut x] = &[0];
| +
error[E0596]: cannot borrow data in a `&` reference as mutable
--> $DIR/ref-binding-on-inh-ref-errors.rs:67:10
|
LL | let [ref mut x] = &[0];
| ^^^^^^^^^ cannot borrow as mutable
error: binding modifiers may only be written when the default binding mode is `move`
--> $DIR/ref-binding-on-inh-ref-errors.rs:75:10
|
LL | let [ref x] = &[0];
| ^^^ default binding mode is `ref`
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
help: make the implied reference pattern explicit
|
LL | let &[ref x] = &[0];
| +
error: binding modifiers may only be written when the default binding mode is `move`
--> $DIR/ref-binding-on-inh-ref-errors.rs:79:10
|
LL | let [ref x] = &mut [0];
| ^^^ default binding mode is `ref mut`
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
help: make the implied reference pattern explicit
|
LL | let &mut [ref x] = &mut [0];
| ++++
error: binding modifiers may only be written when the default binding mode is `move`
--> $DIR/ref-binding-on-inh-ref-errors.rs:83:10
|
LL | let [ref mut x] = &mut [0];
| ^^^^^^^ default binding mode is `ref mut`
|
= note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/match-ergonomics.html>
help: make the implied reference pattern explicit
|
LL | let &mut [ref mut x] = &mut [0];
| ++++
error: aborting due to 6 previous errors
Some errors have detailed explanations: E0308, E0596.
For more information about an error, try `rustc --explain E0308`.