fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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