rust/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.stable2021.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

42 lines
1.3 KiB
Text

error[E0308]: mismatched types
--> $DIR/ref-binding-on-inh-ref-errors.rs:39:10
|
LL | let [&ref x] = &[&mut 0];
| ^^^^^^ --------- this expression has type `&[&mut {integer}; 1]`
| |
| types differ in mutability
|
= note: expected mutable reference `&mut {integer}`
found reference `&_`
help: consider removing `&` from the pattern
|
LL - let [&ref x] = &[&mut 0];
LL + let [ref x] = &[&mut 0];
|
error[E0308]: mismatched types
--> $DIR/ref-binding-on-inh-ref-errors.rs:45:10
|
LL | let [&ref x] = &mut [&mut 0];
| ^^^^^^ ------------- this expression has type `&mut [&mut {integer}; 1]`
| |
| types differ in mutability
|
= note: expected mutable reference `&mut {integer}`
found reference `&_`
help: consider removing `&` from the pattern
|
LL - let [&ref x] = &mut [&mut 0];
LL + let [ref x] = &mut [&mut 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: aborting due to 3 previous errors
Some errors have detailed explanations: E0308, E0596.
For more information about an error, try `rustc --explain E0308`.