]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
Rollup merge of #69625 - Stebalien:feat/iter-copy-specialize, r=KodrAus
[rust.git] / src / test / ui / borrowck / borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
1 error[E0594]: cannot assign to `**t1` which is behind a `&` reference
2   --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
3    |
4 LL |     let t1 = t0;
5    |         -- help: consider changing this to be a mutable reference: `&mut &mut isize`
6 LL |     let p: &isize = &**t0;
7 LL |     **t1 = 22;
8    |     ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
9
10 error[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    |
13 LL |     let t1 = &mut *t0;
14    |              -------- mutable borrow occurs here
15 LL |     let p: &isize = &**t0;
16    |                     ^^^^^ immutable borrow occurs here
17 LL |     **t1 = 22;
18    |     --------- mutable borrow later used here
19
20 error[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    |
23 LL | fn foo4(t0: & &mut isize) {
24    |             ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
25 LL |     let x:  &mut isize = &mut **t0;
26    |                          ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
27
28 error: aborting due to 3 previous errors
29
30 Some errors have detailed explanations: E0502, E0594, E0596.
31 For more information about an error, try `rustc --explain E0502`.