fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
1.4 KiB31 linesraw
1error[E0594]: cannot assign to `**t1` which is behind a `&` reference
2  --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
3   |
4LL |     let t1 = t0;
5   |         -- help: consider changing this to be a mutable reference: `&mut &mut isize`
6LL |     let p: &isize = &**t0;
7LL |     **t1 = 22;
8   |     ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
9
10error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable
11  --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21
12   |
13LL |     let t1 = &mut *t0;
14   |              -------- mutable borrow occurs here
15LL |     let p: &isize = &**t0;
16   |                     ^^^^^ immutable borrow occurs here
17LL |     **t1 = 22;
18   |     --------- mutable borrow later used here
19
20error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference
21  --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26
22   |
23LL | fn foo4(t0: & &mut isize) {
24   |             ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
25LL |     let x:  &mut isize = &mut **t0;
26   |                          ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
27
28error: aborting due to 3 previous errors
29
30Some errors have detailed explanations: E0502, E0594, E0596.
31For more information about an error, try `rustc --explain E0502`.