]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-mut-borrow-of-mut-base-ptr.nll.stderr
CommitLineData
b7449926
XL
1error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:21:18
3 |
4LL | let p: &isize = &*t0; // Freezes `*t0`
5 | ---- immutable borrow occurs here
6LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
7 | ^^^^^^^ mutable borrow occurs here
8LL | **t2 += 1; // Mutates `*t0`
9LL | p.use_ref();
0bf4aa26 10 | - immutable borrow later used here
b7449926
XL
11
12error[E0499]: cannot borrow `t0` as mutable more than once at a time
13 --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:29:18
14 |
15LL | let p: &mut isize = &mut *t0; // Claims `*t0`
16 | -------- first mutable borrow occurs here
17LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0`
18 | ^^^^^^^ second mutable borrow occurs here
19LL | **t2 += 1; // Mutates `*t0` but not through `*p`
20LL | p.use_mut();
0bf4aa26 21 | - first borrow later used here
b7449926
XL
22
23error: aborting due to 2 previous errors
24
25Some errors occurred: E0499, E0502.
26For more information about an error, try `rustc --explain E0499`.