gcc/testsuite/rust/execute/torture/builtin_macro_line.rs
raw| 1 | // { dg-output "20\r*\n23\r*\n" } |
| 2 | #![feature(rustc_attrs)] |
| 3 | |
| 4 | extern "C" { |
| 5 | fn printf(fmt: *const i8, ...); |
| 6 | } |
| 7 | |
| 8 | fn print(s: u32) { |
| 9 | unsafe { |
| 10 | printf("%u\n\0" as *const str as *const i8, s); |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | #[rustc_builtin_macro] |
| 15 | macro_rules! line { |
| 16 | () => {{}}; |
| 17 | } |
| 18 | |
| 19 | fn main() -> i32 { |
| 20 | let a = line!(); |
| 21 | print(a); |
| 22 | |
| 23 | let b = line!(); |
| 24 | print(b); |
| 25 | |
| 26 | 0 |
| 27 | } |