| 1 |
// { dg-output "\r*\ntest10btrue2.15\r*\ntest10bfalse2.151\r*\n" } |
| 2 |
#![feature(rustc_attrs)] |
| 3 |
|
| 4 |
#[rustc_builtin_macro] |
| 5 |
macro_rules! concat { |
| 6 |
() => {{}}; |
| 7 |
} |
| 8 |
|
| 9 |
extern "C" { |
| 10 |
fn printf(fmt: *const i8, ...); |
| 11 |
} |
| 12 |
|
| 13 |
fn print(s: &str) { |
| 14 |
unsafe { |
| 15 |
printf( |
| 16 |
"%s\n" as *const str as *const i8, |
| 17 |
s as *const str as *const i8, |
| 18 |
); |
| 19 |
} |
| 20 |
} |
| 21 |
|
| 22 |
fn main() -> i32 { |
| 23 |
let a = concat!(); |
| 24 |
let b = concat!("test", 10, 'b', true, 2.15); |
| 25 |
let c = concat!("test", 10, 'b', false, 2.15, 1u64); |
| 26 |
print(a); |
| 27 |
print(b); |
| 28 |
print(c); |
| 29 |
|
| 30 |
0 |
| 31 |
} |