fork/rust

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

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
2.0 KiB59 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 x = 0;
5   |         - help: consider changing this to be mutable: `mut x`
6LL |     let y = &raw mut x;
7   |             ^^^^^^^^^^ cannot borrow as mutable
8
9error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable
10  --> $DIR/borrow-raw-address-of-mutability.rs:11:17
11   |
12LL |     let x = 0;
13   |         - help: consider changing this to be mutable: `mut x`
14LL |     let mut f = || {
15LL |         let y = &raw mut x;
16   |                 ^^^^^^^^^^ cannot borrow as mutable
17
18error[E0596]: cannot borrow `f` as mutable, as it is not declared as mutable
19  --> $DIR/borrow-raw-address-of-mutability.rs:21:5
20   |
21LL |     let f = || {
22   |         - help: consider changing this to be mutable: `mut f`
23...
24LL |     f();
25   |     ^ cannot borrow as mutable
26
27error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
28  --> $DIR/borrow-raw-address-of-mutability.rs:29:17
29   |
30LL |         let y = &raw mut x;
31   |                 ^^^^^^^^^^ cannot borrow as mutable
32   |
33help: consider changing this to accept closures that implement `FnMut`
34  --> $DIR/borrow-raw-address-of-mutability.rs:28:21
35   |
36LL |       let f = make_fn(|| {
37   |  _____________________^
38LL | |         let y = &raw mut x;
39LL | |     });
40   | |_____^
41
42error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
43  --> $DIR/borrow-raw-address-of-mutability.rs:37:17
44   |
45LL |         let y = &raw mut x;
46   |                 ^^^^^^^^^^ cannot borrow as mutable
47   |
48help: consider changing this to accept closures that implement `FnMut`
49  --> $DIR/borrow-raw-address-of-mutability.rs:36:21
50   |
51LL |       let f = make_fn(move || {
52   |  _____________________^
53LL | |         let y = &raw mut x;
54LL | |     });
55   | |_____^
56
57error: aborting due to 5 previous errors
58
59For more information about this error, try `rustc --explain E0596`.