fork/rust

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

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

1.39.0
1.6 KiB44 linesraw
1warning[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   |
13   = warning: this error has been downgraded to a warning for backwards compatibility with previous releases
14   = warning: this represents potential undefined behavior in your code and this warning will become a hard error in the future
15   = note: for more information, try `rustc --explain E0729`
16
17error[E0503]: cannot use `y` because it was mutably borrowed
18  --> $DIR/borrowck-anon-fields-variant.rs:37:7
19   |
20LL |       Foo::Y(ref mut a, _) => a,
21   |              --------- borrow of `y.0` occurs here
22...
23LL |       Foo::Y(ref mut b, _) => b,
24   |       ^^^^^^^^^^^^^^^^^^^^ use of borrowed `y.0`
25...
26LL |     *a += 1;
27   |     ------- borrow later used here
28
29error[E0499]: cannot borrow `y.0` as mutable more than once at a time
30  --> $DIR/borrowck-anon-fields-variant.rs:37:14
31   |
32LL |       Foo::Y(ref mut a, _) => a,
33   |              --------- first mutable borrow occurs here
34...
35LL |       Foo::Y(ref mut b, _) => b,
36   |              ^^^^^^^^^ second mutable borrow occurs here
37...
38LL |     *a += 1;
39   |     ------- first borrow later used here
40
41error: aborting due to 2 previous errors
42
43Some errors have detailed explanations: E0499, E0503.
44For more information about an error, try `rustc --explain E0499`.