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