]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / borrowck / borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
1 error[E0389]: cannot assign to data in a `&` reference
2   --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
3    |
4 LL |     **t1 = 22; //~ ERROR cannot assign
5    |     ^^^^^^^^^ assignment into an immutable reference
6
7 error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable
8   --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:22
9    |
10 LL |     let t1 = &mut *t0;
11    |                   --- mutable borrow occurs here
12 LL |     let p: &isize = &**t0; //~ ERROR cannot borrow
13    |                      ^^^^ immutable borrow occurs here
14 LL |     **t1 = 22;
15 LL | }
16    | - mutable borrow ends here
17
18 error[E0389]: cannot borrow data mutably in a `&` reference
19   --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:31
20    |
21 LL | fn foo4(t0: & &mut isize) {
22    |             ------------ use `&mut &mut isize` here to make mutable
23 LL |     let x:  &mut isize = &mut **t0; //~ ERROR cannot borrow
24    |                               ^^^^ assignment into an immutable reference
25
26 error: aborting due to 3 previous errors
27
28 Some errors occurred: E0389, E0502.
29 For more information about an error, try `rustc --explain E0389`.