]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-access-permissions.stderr
Rollup merge of #106644 - alexcrichton:update-wasi-toolchain, r=cuviper
[rust.git] / tests / ui / borrowck / borrowck-access-permissions.stderr
1 error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2   --> $DIR/borrowck-access-permissions.rs:9:19
3    |
4 LL |         let _y1 = &mut x;
5    |                   ^^^^^^ cannot borrow as mutable
6    |
7 help: consider changing this to be mutable
8    |
9 LL |     let mut x = 1;
10    |         +++
11
12 error[E0596]: cannot borrow immutable static item `static_x` as mutable
13   --> $DIR/borrowck-access-permissions.rs:14:19
14    |
15 LL |         let _y1 = &mut static_x;
16    |                   ^^^^^^^^^^^^^ cannot borrow as mutable
17
18 error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
19   --> $DIR/borrowck-access-permissions.rs:22:19
20    |
21 LL |         let _y1 = &mut *box_x;
22    |                   ^^^^^^^^^^^ cannot borrow as mutable
23    |
24 help: consider changing this to be mutable
25    |
26 LL |         let mut box_x = Box::new(1);
27    |             +++
28
29 error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
30   --> $DIR/borrowck-access-permissions.rs:30:19
31    |
32 LL |         let _y1 = &mut *ref_x;
33    |                   ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
34    |
35 help: consider changing this to be a mutable reference
36    |
37 LL |         let ref_x = &mut x;
38    |                     ~~~~~~
39
40 error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
41   --> $DIR/borrowck-access-permissions.rs:39:23
42    |
43 LL |             let _y1 = &mut *ptr_x;
44    |                       ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
45    |
46 help: consider changing this to be a mutable pointer
47    |
48 LL |         let ptr_x : *const _ = &mut x;
49    |                                ~~~~~~
50
51 error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
52   --> $DIR/borrowck-access-permissions.rs:48:18
53    |
54 LL |         let _y = &mut *foo_ref.f;
55    |                  ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
56    |
57 help: consider changing this to be a mutable reference
58    |
59 LL |         let foo_ref = &mut foo;
60    |                       ~~~~~~~~
61
62 error: aborting due to 6 previous errors
63
64 For more information about this error, try `rustc --explain E0596`.