fork/rust

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

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

master
1.1 KiB35 linesraw
1error[E0506]: cannot assign to `p.x` because it is borrowed
2  --> $DIR/borrowck-assign-comp.rs:10:5
3   |
4LL |     let q = &p;
5   |             -- `p.x` is borrowed here
6...
7LL |     p.x = 5;
8   |     ^^^^^^^ `p.x` is assigned to here but it was already borrowed
9LL |     q.x;
10   |     --- borrow later used here
11
12error[E0506]: cannot assign to `p` because it is borrowed
13  --> $DIR/borrowck-assign-comp.rs:20:5
14   |
15LL |     let q = &p.y;
16   |             ---- `p` is borrowed here
17LL |     p = Point {x: 5, y: 7};
18   |     ^^^^^^^^^^^^^^^^^^^^^^ `p` is assigned to here but it was already borrowed
19LL |     p.x; // silence warning
20LL |     *q; // stretch loan
21   |     -- borrow later used here
22
23error[E0506]: cannot assign to `p.y` because it is borrowed
24  --> $DIR/borrowck-assign-comp.rs:31:5
25   |
26LL |     let q = &p.y;
27   |             ---- `p.y` is borrowed here
28LL |     p.y = 5;
29   |     ^^^^^^^ `p.y` is assigned to here but it was already borrowed
30LL |     *q;
31   |     -- borrow later used here
32
33error: aborting due to 3 previous errors
34
35For more information about this error, try `rustc --explain E0506`.