summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-27889.rs
blob: 623416a5d0032e12b9697ef1b2fcf1af13d9f17d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// check-pass
#![allow(unused_assignments)]
#![allow(unused_variables)]
// 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() {}