]> git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-match-already-borrowed.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-match-already-borrowed.rs
1 enum Foo {
2 A(i32),
3 B
4 }
5
6 fn match_enum() {
7 let mut foo = Foo::B;
8 let p = &mut foo;
9 let _ = match foo { //~ ERROR [E0503]
10 Foo::B => 1,
11 _ => 2,
12 Foo::A(x) => x //~ ERROR [E0503]
13 };
14 drop(p);
15 }
16
17
18 fn main() {
19 let mut x = 1;
20 let r = &mut x;
21 let _ = match x {
22 x => x + 1, //~ ERROR [E0503]
23 y => y + 2, //~ ERROR [E0503]
24 };
25 drop(r);
26 }