fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
1.1 KiB26 linesraw
1error[E0502]: cannot borrow `t0` as mutable because it is also borrowed as immutable
2  --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:11:18
3   |
4LL |     let p: &isize = &*t0;     // Freezes `*t0`
5   |                     ---- immutable borrow occurs here
6LL |     let mut t2 = &mut t0;
7   |                  ^^^^^^^ mutable borrow occurs here
8LL |     **t2 += 1;              // Mutates `*t0`
9LL |     p.use_ref();
10   |     - immutable borrow later used here
11
12error[E0499]: cannot borrow `t0` as mutable more than once at a time
13  --> $DIR/borrowck-mut-borrow-of-mut-base-ptr.rs:19:18
14   |
15LL |     let p: &mut isize = &mut *t0; // Claims `*t0`
16   |                         -------- first mutable borrow occurs here
17LL |     let mut t2 = &mut t0;
18   |                  ^^^^^^^ second mutable borrow occurs here
19LL |     **t2 += 1;                  // Mutates `*t0` but not through `*p`
20LL |     p.use_mut();
21   |     - first borrow later used here
22
23error: aborting due to 2 previous errors
24
25Some errors have detailed explanations: E0499, E0502.
26For more information about an error, try `rustc --explain E0499`.