]>
Commit | Line | Data |
---|---|---|
b7449926 XL |
1 | error[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 | | | |
4 | LL | let p: &isize = &*t0; // Freezes `*t0` | |
5 | | ---- immutable borrow occurs here | |
6 | LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` | |
7 | | ^^^^^^^ mutable borrow occurs here | |
8 | LL | **t2 += 1; // Mutates `*t0` | |
9 | LL | p.use_ref(); | |
0bf4aa26 | 10 | | - immutable borrow later used here |
b7449926 XL |
11 | |
12 | error[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 | | | |
15 | LL | let p: &mut isize = &mut *t0; // Claims `*t0` | |
16 | | -------- first mutable borrow occurs here | |
17 | LL | let mut t2 = &mut t0; //~ ERROR cannot borrow `t0` | |
18 | | ^^^^^^^ second mutable borrow occurs here | |
19 | LL | **t2 += 1; // Mutates `*t0` but not through `*p` | |
20 | LL | p.use_mut(); | |
0bf4aa26 | 21 | | - first borrow later used here |
b7449926 XL |
22 | |
23 | error: aborting due to 2 previous errors | |
24 | ||
25 | Some errors occurred: E0499, E0502. | |
26 | For more information about an error, try `rustc --explain E0499`. |