fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

1.39.0
2.9 KiB95 linesraw
1error[E0503]: cannot use `x` because it was mutably borrowed
2  --> $DIR/borrowck-use-mut-borrow.rs:11:10
3   |
4LL |     let p = &mut x;
5   |             ------ borrow of `x` occurs here
6LL |     drop(x);
7   |          ^ use of borrowed `x`
8LL |     *p = 2;
9   |     ------ borrow later used here
10
11error[E0503]: cannot use `x` because it was mutably borrowed
12  --> $DIR/borrowck-use-mut-borrow.rs:18:10
13   |
14LL |     let p = &mut x.a;
15   |             -------- borrow of `x.a` occurs here
16LL |     drop(x);
17   |          ^ use of borrowed `x.a`
18LL |     *p = 3;
19   |     ------ borrow later used here
20
21error[E0503]: cannot use `x.a` because it was mutably borrowed
22  --> $DIR/borrowck-use-mut-borrow.rs:25:10
23   |
24LL |     let p = &mut x;
25   |             ------ borrow of `x` occurs here
26LL |     drop(x.a);
27   |          ^^^ use of borrowed `x`
28LL |     p.a = 3;
29   |     ------- borrow later used here
30
31error[E0503]: cannot use `x.a` because it was mutably borrowed
32  --> $DIR/borrowck-use-mut-borrow.rs:32:10
33   |
34LL |     let p = &mut x.a;
35   |             -------- borrow of `x.a` occurs here
36LL |     drop(x.a);
37   |          ^^^ use of borrowed `x.a`
38LL |     *p = 3;
39   |     ------ borrow later used here
40
41error[E0503]: cannot use `x.a` because it was mutably borrowed
42  --> $DIR/borrowck-use-mut-borrow.rs:39:13
43   |
44LL |     let p = &mut x;
45   |             ------ borrow of `x` occurs here
46LL |     let y = A { b: 3, .. x };
47   |             ^^^^^^^^^^^^^^^^ use of borrowed `x`
48LL |     drop(y);
49LL |     p.a = 4;
50   |     ------- borrow later used here
51
52error[E0503]: cannot use `x.a` because it was mutably borrowed
53  --> $DIR/borrowck-use-mut-borrow.rs:47:13
54   |
55LL |     let p = &mut x.a;
56   |             -------- borrow of `x.a` occurs here
57LL |     let y = A { b: 3, .. x };
58   |             ^^^^^^^^^^^^^^^^ use of borrowed `x.a`
59LL |     drop(y);
60LL |     *p = 4;
61   |     ------ borrow later used here
62
63error[E0503]: cannot use `*x` because it was mutably borrowed
64  --> $DIR/borrowck-use-mut-borrow.rs:55:10
65   |
66LL |     let p = &mut x;
67   |             ------ borrow of `x` occurs here
68LL |     drop(*x);
69   |          ^^ use of borrowed `x`
70LL |     **p = 2;
71   |     ------- borrow later used here
72
73error[E0503]: cannot use `*x.b` because it was mutably borrowed
74  --> $DIR/borrowck-use-mut-borrow.rs:62:10
75   |
76LL |     let p = &mut x;
77   |             ------ borrow of `x` occurs here
78LL |     drop(*x.b);
79   |          ^^^^ use of borrowed `x`
80LL |     p.a = 3;
81   |     ------- borrow later used here
82
83error[E0503]: cannot use `*x.b` because it was mutably borrowed
84  --> $DIR/borrowck-use-mut-borrow.rs:69:10
85   |
86LL |     let p = &mut x.b;
87   |             -------- borrow of `x.b` occurs here
88LL |     drop(*x.b);
89   |          ^^^^ use of borrowed `x.b`
90LL |     **p = 3;
91   |     ------- borrow later used here
92
93error: aborting due to 9 previous errors
94
95For more information about this error, try `rustc --explain E0503`.