summaryrefslogtreecommitdiffstats
path: root/tests/ui/codegen/issue-16602-3.rs
blob: ca1ab3cc7feb909e62258fa12260e2ab3fec7daa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// run-pass
#![allow(unused_variables)]
#![allow(unused_assignments)]
#[derive(Debug)]
#[allow(unused_tuple_struct_fields)]
enum Foo {
    Bar(u32, u32),
    Baz(&'static u32, &'static u32)
}

static NUM: u32 = 100;

fn main () {
    let mut b = Foo::Baz(&NUM, &NUM);
    b = Foo::Bar(f(&b), g(&b));
}

static FNUM: u32 = 1;

fn f (b: &Foo) -> u32 {
    FNUM
}

static GNUM: u32 = 2;

fn g (b: &Foo) -> u32 {
    GNUM
}