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