fork/rust

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

borsAuto merge of #71365 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4fb7144ed15

1.43.0
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   |             -- borrow of `p.x` occurs here
6...
7LL |     p.x = 5;
8   |     ^^^^^^^ assignment to borrowed `p.x` occurs here
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   |             ---- borrow of `p` occurs here
17LL |     p = Point {x: 5, y: 7};
18   |     ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
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   |             ---- borrow of `p.y` occurs here
28LL |     p.y = 5;
29   |     ^^^^^^^ assignment to borrowed `p.y` occurs here
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`.