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