]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-assign-comp.mir.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / borrowck / borrowck-assign-comp.mir.stderr
1 error[E0506]: cannot assign to `p.x` because it is borrowed
2   --> $DIR/borrowck-assign-comp.rs:13:5
3    |
4 LL |     let q = &p;
5    |             -- borrow of `p.x` occurs here
6 ...
7 LL |     p.x = 5; //[ast]~ ERROR cannot assign to `p.x`
8    |     ^^^^^^^ assignment to borrowed `p.x` occurs here
9 LL |              //[mir]~^ ERROR cannot assign to `p.x` because it is borrowed
10 LL |     q.x;
11    |     --- borrow later used here
12
13 error[E0506]: cannot assign to `p` because it is borrowed
14   --> $DIR/borrowck-assign-comp.rs:24:5
15    |
16 LL |     let q = &p.y;
17    |             ---- borrow of `p` occurs here
18 LL |     p = Point {x: 5, y: 7};//[ast]~ ERROR cannot assign to `p`
19    |     ^^^^^^^^^^^^^^^^^^^^^^ assignment to borrowed `p` occurs here
20 ...
21 LL |     *q; // stretch loan
22    |     -- borrow later used here
23
24 error[E0506]: cannot assign to `p.y` because it is borrowed
25   --> $DIR/borrowck-assign-comp.rs:36:5
26    |
27 LL |     let q = &p.y;
28    |             ---- borrow of `p.y` occurs here
29 LL |     p.y = 5; //[ast]~ ERROR cannot assign to `p.y`
30    |     ^^^^^^^ assignment to borrowed `p.y` occurs here
31 LL |              //[mir]~^ ERROR cannot assign to `p.y` because it is borrowed
32 LL |     *q;
33    |     -- borrow later used here
34
35 error: aborting due to 3 previous errors
36
37 For more information about this error, try `rustc --explain E0506`.