]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-access-permissions.ast.stderr
use structured suggestion for "missing mut" label
[rust.git] / src / test / ui / borrowck / borrowck-access-permissions.ast.stderr
1 error[E0596]: cannot borrow immutable local variable `x` as mutable
2   --> $DIR/borrowck-access-permissions.rs:22:24
3    |
4 LL |     let x = 1;
5    |         - help: make this binding mutable: `mut x`
6 ...
7 LL |         let _y1 = &mut x; //[ast]~ ERROR [E0596]
8    |                        ^ cannot borrow mutably
9
10 error[E0596]: cannot borrow immutable static item as mutable
11   --> $DIR/borrowck-access-permissions.rs:28:24
12    |
13 LL |         let _y1 = &mut static_x; //[ast]~ ERROR [E0596]
14    |                        ^^^^^^^^
15
16 error[E0596]: cannot borrow immutable `Box` content `*box_x` as mutable
17   --> $DIR/borrowck-access-permissions.rs:37:24
18    |
19 LL |         let box_x = Box::new(1);
20    |             ----- help: make this binding mutable: `mut box_x`
21 ...
22 LL |         let _y1 = &mut *box_x; //[ast]~ ERROR [E0596]
23    |                        ^^^^^^ cannot borrow as mutable
24
25 error[E0596]: cannot borrow immutable borrowed content `*ref_x` as mutable
26   --> $DIR/borrowck-access-permissions.rs:46:24
27    |
28 LL |         let _y1 = &mut *ref_x; //[ast]~ ERROR [E0596]
29    |                        ^^^^^^ cannot borrow as mutable
30
31 error[E0596]: cannot borrow immutable dereference of raw pointer `*ptr_x` as mutable
32   --> $DIR/borrowck-access-permissions.rs:56:28
33    |
34 LL |             let _y1 = &mut *ptr_x; //[ast]~ ERROR [E0596]
35    |                            ^^^^^^ cannot borrow as mutable
36
37 error[E0389]: cannot borrow data mutably in a `&` reference
38   --> $DIR/borrowck-access-permissions.rs:66:23
39    |
40 LL |         let _y = &mut *foo_ref.f; //[ast]~ ERROR [E0389]
41    |                       ^^^^^^^^^^ assignment into an immutable reference
42
43 error: aborting due to 6 previous errors
44
45 Some errors occurred: E0389, E0596.
46 For more information about an error, try `rustc --explain E0389`.