aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/macro54.rs
blob: d3b3f806a6a089d7e38adc6f8be0d342eb48c737 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
#[lang = "sized"]
pub trait Sized {}

macro_rules! foo {
    () => {"foo"};
    (number) => { 12 };
    (false) => { false };
}

pub const A: &'static str = foo!();
pub static B: &'static str = foo!();

pub trait Number {
    const VALUE: u32;
}

impl Number for u32 {
    const VALUE: u32 = foo!(number);
}

impl u32 {
    pub const TWELVE: u32 = foo!(number);
}

pub enum E {
    Variant = foo!(number),
}

pub fn f(c: bool) -> &'static str {
    match c {
        false => foo!(),
        true if foo!(false) => "abc",
        _ => "xyz"
    }
}


fn main() {
    let _ = A;
    let _ = u32::VALUE - u32::TWELVE;
}