aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/macro40.rs
blob: f9d048e8ab1d2e6e6761c4e0cd85537dffc1851e (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
43
44
45
46
47
48
49
50
51
// { dg-additional-options "-w" }

#[lang = "sized"]
pub trait Sized {}

macro_rules! t {
    () => {
        i32
    };
}

macro_rules! s {
    () => {
        *const i8
    };
}

extern "C" {
    fn printf(s: s!(), ...);
}

fn square(arg: t!()) -> t!() {
    let input: t!() = arg;

    input * input
}

trait Trait {
    fn f() -> t!();
    fn g(arg: t!());
}

struct Wrapper {
    inner: t!(),
}

impl Trait for Wrapper {
    fn f() -> t!() {
        1
    }

    fn g(arg: t!()) {}
}

fn id<T>(arg: T) -> T {
    arg
}

fn main() {
    id::<t!()>(15);
}