rust/src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
2019-04-18 13:29:28 -04:00

30 lines
1.1 KiB
Plaintext

error[E0389]: cannot assign to data in a `&` reference
--> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
|
LL | **t1 = 22;
| ^^^^^^^^^ assignment into an immutable reference
error[E0502]: cannot borrow `**t0` as immutable because `*t0` is also borrowed as mutable
--> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:22
|
LL | let t1 = &mut *t0;
| --- mutable borrow occurs here
LL | let p: &isize = &**t0;
| ^^^^ immutable borrow occurs here
LL | **t1 = 22;
LL | }
| - mutable borrow ends here
error[E0389]: cannot borrow data mutably in a `&` reference
--> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:31
|
LL | fn foo4(t0: & &mut isize) {
| ------------ use `&mut &mut isize` here to make mutable
LL | let x: &mut isize = &mut **t0;
| ^^^^ assignment into an immutable reference
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0389, E0502.
For more information about an error, try `rustc --explain E0389`.