Files
rust/tests/ui/pattern/rfc-3627-match-ergonomics-2024/experimental/ref-binding-on-inh-ref-errors.stable2021.stderr
dianne e24833a4a8 add test revisions for old-edition behavior of feature gates
This also adds `#[cfg]` attributes to tests for bindings' types,
to make it visually clearer which revisions type successfully.
2025-02-18 17:44:28 -08:00

43 lines
1.3 KiB
Plaintext

error[E0308]: mismatched types
--> $DIR/ref-binding-on-inh-ref-errors.rs:41: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:48: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:71: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`.