2019-11-03 18:00:00 -06:00
|
|
|
// check-pass
|
2018-09-25 16:51:35 -05:00
|
|
|
#![allow(unused_assignments)]
|
|
|
|
#![allow(unused_variables)]
|
2015-08-21 01:22:51 -05:00
|
|
|
// Test that a field can have the same name in different variants
|
|
|
|
// of an enum
|
|
|
|
|
|
|
|
pub enum Foo {
|
|
|
|
X { foo: u32 },
|
|
|
|
Y { foo: u32 }
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn foo(mut x: Foo) {
|
|
|
|
let mut y = None;
|
|
|
|
let mut z = None;
|
|
|
|
if let Foo::X { ref foo } = x {
|
|
|
|
z = Some(foo);
|
|
|
|
}
|
|
|
|
if let Foo::Y { ref mut foo } = x {
|
|
|
|
y = Some(foo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|