fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.5 KiB51 linesraw
1error[E0503]: cannot use `foo` because it was mutably borrowed
2  --> $DIR/borrowck-match-already-borrowed.rs:10:9
3   |
4LL |     let p = &mut foo;
5   |             -------- borrow of `foo` occurs here
6LL |     let _ = match foo {
7LL |         Foo::B => 1,
8   |         ^^^^^^ use of borrowed `foo`
9...
10LL |     drop(p);
11   |          - borrow later used here
12
13error[E0503]: cannot use `foo.0` because it was mutably borrowed
14  --> $DIR/borrowck-match-already-borrowed.rs:12:16
15   |
16LL |     let p = &mut foo;
17   |             -------- borrow of `foo` occurs here
18...
19LL |         Foo::A(x) => x
20   |                ^ use of borrowed `foo`
21LL |     };
22LL |     drop(p);
23   |          - borrow later used here
24
25error[E0503]: cannot use `x` because it was mutably borrowed
26  --> $DIR/borrowck-match-already-borrowed.rs:22:9
27   |
28LL |     let r = &mut x;
29   |             ------ borrow of `x` occurs here
30LL |     let _ = match x {
31LL |         x => x + 1,
32   |         ^ use of borrowed `x`
33...
34LL |     drop(r);
35   |          - borrow later used here
36
37error[E0503]: cannot use `x` because it was mutably borrowed
38  --> $DIR/borrowck-match-already-borrowed.rs:23:9
39   |
40LL |     let r = &mut x;
41   |             ------ borrow of `x` occurs here
42...
43LL |         y => y + 2,
44   |         ^ use of borrowed `x`
45LL |     };
46LL |     drop(r);
47   |          - borrow later used here
48
49error: aborting due to 4 previous errors
50
51For more information about this error, try `rustc --explain E0503`.