This also adds `#[cfg]` attributes to tests for bindings' types, to make it visually clearer which revisions type successfully.
43 lines
1.3 KiB
Plaintext
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`.
|