rust/src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.stderr

27 lines
931 B
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `t0` as mutable because `*t0` is also borrowed as immutable
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:23
2018-08-08 07:28:26 -05:00
|
LL | let p: &isize = &*t0; // Freezes `*t0`
| --- immutable borrow occurs here
2019-03-09 06:03:44 -06:00
LL | let mut t2 = &mut t0;
2018-08-08 07:28:26 -05:00
| ^^ mutable borrow occurs here
...
2018-08-08 07:28:26 -05:00
LL | }
| - immutable borrow ends here
error[E0499]: cannot borrow `t0` as mutable more than once at a time
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:23
2018-08-08 07:28:26 -05:00
|
LL | let p: &mut isize = &mut *t0; // Claims `*t0`
| --- first mutable borrow occurs here
2019-03-09 06:03:44 -06:00
LL | let mut t2 = &mut t0;
2018-08-08 07:28:26 -05:00
| ^^ second mutable borrow occurs here
...
2018-08-08 07:28:26 -05:00
LL | }
| - first borrow ends here
error: aborting due to 2 previous errors
Some errors occurred: E0499, E0502.
For more information about an error, try `rustc --explain E0499`.