]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-27889.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / issues / issue-27889.rs
1 // check-pass
2 #![allow(unused_assignments)]
3 #![allow(unused_variables)]
4 // Test that a field can have the same name in different variants
5 // of an enum
6
7 pub enum Foo {
8 X { foo: u32 },
9 Y { foo: u32 }
10 }
11
12 pub fn foo(mut x: Foo) {
13 let mut y = None;
14 let mut z = None;
15 if let Foo::X { ref foo } = x {
16 z = Some(foo);
17 }
18 if let Foo::Y { ref mut foo } = x {
19 y = Some(foo);
20 }
21 }
22
23 fn main() {}