]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-27889.rs
Auto merge of #57108 - Mark-Simulacrum:license-remove, r=pietroalbini
[rust.git] / src / test / ui / issues / issue-27889.rs
1 // compile-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() {}