rust/tests/ui/closures/2229_closure_analysis/array_subslice.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

29 lines
891 B
Plaintext
Raw Normal View History

2023-03-27 21:23:10 +00:00
error[E0596]: cannot borrow `x[..]` as mutable, as `x` is not declared as mutable
--> $DIR/array_subslice.rs:7:21
|
LL | let [ref y, ref mut z @ ..] = x;
| ^^^^^^^^^ cannot borrow as mutable
2024-07-03 23:26:10 +00:00
|
help: consider changing this to be mutable
|
LL | pub fn subslice_array(mut x: [u8; 3]) {
| +++
2023-03-27 21:23:10 +00:00
error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
--> $DIR/array_subslice.rs:10:5
|
LL | let [ref y, ref mut z @ ..] = x;
| - calling `f` requires mutable binding due to mutable borrow of `x`
...
LL | f();
| ^ cannot borrow as mutable
|
help: consider changing this to be mutable
|
LL | let mut f = || {
| +++
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0596`.