File: array_subslice.stderr

package info (click to toggle)
rustc 1.70.0%2Bdfsg1-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 722,120 kB
  • sloc: xml: 147,962; javascript: 10,210; sh: 8,590; python: 8,220; ansic: 5,901; cpp: 4,635; makefile: 4,001; asm: 2,856
file content (26 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
error[E0596]: cannot borrow `x[..]` as mutable, as `x` is not declared as mutable
  --> $DIR/array_subslice.rs:7:21
   |
LL | pub fn subslice_array(x: [u8; 3]) {
   |                       - help: consider changing this to be mutable: `mut x`
...
LL |         let [ref y, ref mut z @ ..] = x;
   |                     ^^^^^^^^^ cannot borrow as mutable

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`.