summaryrefslogtreecommitdiff
path: root/samples/test/misc_macro_issues.rs
blob: 5b35ac31c9a827309eb18aa38f7ce433582fda91 (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
42
// compile-flags: --test

// #55 - Doesn't allow macros for :item
macro_rules! outer {
    ($it:item) => {}
}
outer! {
    inner! {}
}

// #59 - 
macro_rules! outer2 {
    ({ $($x:item)* }) => {}
}
outer2! {
    {inner!{}}
}


// #56 - Unexpanded macro in type
macro_rules! m {
    ($tt:tt) => { $tt }
}

struct A;
struct B;

impl From<m!(A)> for B {
    fn from(_: A) -> B {
        unimplemented!()
    }
}

// #61 - Not expanding macros in paths in types
macro_rules! Ty {
    () => { u8 }
}

fn f() -> Option<Ty![]> {
    None
}