File: borrowck-access-permissions.stderr

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (64 lines) | stat: -rw-r--r-- 2,301 bytes parent folder | download | duplicates (3)
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
  --> $DIR/borrowck-access-permissions.rs:10:19
   |
LL |         let _y1 = &mut x;
   |                   ^^^^^^ cannot borrow as mutable
   |
help: consider changing this to be mutable
   |
LL |     let mut x = 1;
   |         +++

error[E0596]: cannot borrow immutable static item `static_x` as mutable
  --> $DIR/borrowck-access-permissions.rs:16:19
   |
LL |         let _y1 = &mut static_x;
   |                   ^^^^^^^^^^^^^ cannot borrow as mutable

error[E0596]: cannot borrow `*box_x` as mutable, as `box_x` is not declared as mutable
  --> $DIR/borrowck-access-permissions.rs:27:19
   |
LL |         let _y1 = &mut *box_x;
   |                   ^^^^^^^^^^^ cannot borrow as mutable
   |
help: consider changing this to be mutable
   |
LL |         let mut box_x = Box::new(1);
   |             +++

error[E0596]: cannot borrow `*ref_x` as mutable, as it is behind a `&` reference
  --> $DIR/borrowck-access-permissions.rs:36:19
   |
LL |         let _y1 = &mut *ref_x;
   |                   ^^^^^^^^^^^ `ref_x` is a `&` reference, so the data it refers to cannot be borrowed as mutable
   |
help: consider changing this to be a mutable reference
   |
LL |         let ref_x = &mut x;
   |                      +++

error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer
  --> $DIR/borrowck-access-permissions.rs:46:23
   |
LL |             let _y1 = &mut *ptr_x;
   |                       ^^^^^^^^^^^ `ptr_x` is a `*const` pointer, so the data it refers to cannot be borrowed as mutable
   |
help: consider changing this to be a mutable pointer
   |
LL |         let ptr_x: *const _ = &mut x;
   |                                +++

error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference
  --> $DIR/borrowck-access-permissions.rs:59:18
   |
LL |         let _y = &mut *foo_ref.f;
   |                  ^^^^^^^^^^^^^^^ `foo_ref` is a `&` reference, so the data it refers to cannot be borrowed as mutable
   |
help: consider changing this to be a mutable reference
   |
LL |         let foo_ref = &mut foo;
   |                        +++

error: aborting due to 6 previous errors

For more information about this error, try `rustc --explain E0596`.