fork/rust

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

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

master
2.2 KiB63 linesraw
1error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
2  --> $DIR/borrow-raw-address-of-mutability.rs:5:13
3   |
4LL |     let y = &raw mut x;
5   |             ^^^^^^^^^^ cannot borrow as mutable
6   |
7help: consider changing this to be mutable
8   |
9LL |     let mut x = 0;
10   |         +++
11
12error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
13  --> $DIR/borrow-raw-address-of-mutability.rs:11:17
14   |
15LL |     let x = 0;
16   |         - help: consider changing this to be mutable: `mut x`
17LL |     let mut f = || {
18LL |         let y = &raw mut x;
19   |                 ^^^^^^^^^^ cannot borrow as mutable
20
21error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
22  --> $DIR/borrow-raw-address-of-mutability.rs:21:5
23   |
24LL |         let y = &raw mut x;
25   |                          - calling `f` requires mutable binding due to mutable borrow of `x`
26LL |     };
27LL |     f();
28   |     ^ cannot borrow as mutable
29   |
30help: consider changing this to be mutable
31   |
32LL |     let mut f = || {
33   |         +++
34
35error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
36  --> $DIR/borrow-raw-address-of-mutability.rs:29:17
37   |
38LL | fn make_fn<F: Fn()>(f: F) -> F { f }
39   |                        - change this to accept `FnMut` instead of `Fn`
40...
41LL |     let f = make_fn(|| {
42   |             ------- -- in this closure
43   |             |
44   |             expects `Fn` instead of `FnMut`
45LL |         let y = &raw mut x;
46   |                 ^^^^^^^^^^ cannot borrow as mutable
47
48error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
49  --> $DIR/borrow-raw-address-of-mutability.rs:37:17
50   |
51LL | fn make_fn<F: Fn()>(f: F) -> F { f }
52   |                        - change this to accept `FnMut` instead of `Fn`
53...
54LL |     let f = make_fn(move || {
55   |             ------- ------- in this closure
56   |             |
57   |             expects `Fn` instead of `FnMut`
58LL |         let y = &raw mut x;
59   |                 ^^^^^^^^^^ cannot borrow as mutable
60
61error: aborting due to 5 previous errors
62
63For more information about this error, try `rustc --explain E0596`.