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.3 KiB40 linesraw
1error[E0503]: cannot use `y` because it was mutably borrowed
2  --> $DIR/borrowck-anon-fields-variant.rs:17:7
3   |
4LL |       Foo::Y(ref mut a, _) => a,
5   |              --------- borrow of `y.0` occurs here
6...
7LL |       Foo::Y(_, ref mut b) => b,
8   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
9...
10LL |     *a += 1;
11   |     ------- borrow later used here
12
13error[E0503]: cannot use `y` because it was mutably borrowed
14  --> $DIR/borrowck-anon-fields-variant.rs:35:7
15   |
16LL |       Foo::Y(ref mut a, _) => a,
17   |              --------- borrow of `y.0` occurs here
18...
19LL |       Foo::Y(ref mut b, _) => b,
20   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
21...
22LL |     *a += 1;
23   |     ------- borrow later used here
24
25error[E0499]: cannot borrow `y.0` as mutable more than once at a time
26  --> $DIR/borrowck-anon-fields-variant.rs:35:14
27   |
28LL |       Foo::Y(ref mut a, _) => a,
29   |              --------- first mutable borrow occurs here
30...
31LL |       Foo::Y(ref mut b, _) => b,
32   |              ^^^^^^^^^ second mutable borrow occurs here
33...
34LL |     *a += 1;
35   |     ------- first borrow later used here
36
37error: aborting due to 3 previous errors
38
39Some errors have detailed explanations: E0499, E0503.
40For more information about an error, try `rustc --explain E0499`.