gcc/testsuite/rust/compile/macros/mbe/macro40.rs
raw| 1 | // { dg-additional-options "-w" } |
| 2 | |
| 3 | #[lang = "sized"] |
| 4 | pub trait Sized {} |
| 5 | |
| 6 | macro_rules! t { |
| 7 | () => { |
| 8 | i32 |
| 9 | }; |
| 10 | } |
| 11 | |
| 12 | macro_rules! s { |
| 13 | () => { |
| 14 | *const i8 |
| 15 | }; |
| 16 | } |
| 17 | |
| 18 | extern "C" { |
| 19 | fn printf(s: s!(), ...); |
| 20 | } |
| 21 | |
| 22 | fn square(arg: t!()) -> t!() { |
| 23 | let input: t!() = arg; |
| 24 | |
| 25 | input * input |
| 26 | } |
| 27 | |
| 28 | trait Trait { |
| 29 | fn f() -> t!(); |
| 30 | fn g(arg: t!()); |
| 31 | } |
| 32 | |
| 33 | struct Wrapper { |
| 34 | inner: t!(), |
| 35 | } |
| 36 | |
| 37 | impl Trait for Wrapper { |
| 38 | fn f() -> t!() { |
| 39 | 1 |
| 40 | } |
| 41 | |
| 42 | fn g(arg: t!()) {} |
| 43 | } |
| 44 | |
| 45 | fn id<T>(arg: T) -> T { |
| 46 | arg |
| 47 | } |
| 48 | |
| 49 | fn main() { |
| 50 | id::<t!()>(15); |
| 51 | } |