| 1 |
#![feature(rustc_attrs)] |
| 2 |
|
| 3 |
#[rustc_builtin_macro] |
| 4 |
macro_rules! include_str { |
| 5 |
() => {{}}; |
| 6 |
} |
| 7 |
|
| 8 |
macro_rules! my_file { |
| 9 |
() => {"include.txt"} |
| 10 |
} |
| 11 |
|
| 12 |
static G_STR:[u8;16] = include_str!(my_file!()); |
| 13 |
|
| 14 |
fn main() { |
| 15 |
let file = "include.txt"; |
| 16 |
include_str!(file); // { dg-error "argument must be a string literal" "" } |
| 17 |
include_str!(); // { dg-error "macro takes 1 argument" "" } |
| 18 |
include_str!("foo.txt", "bar.txt"); // { dg-error "macro takes 1 argument" "" } |
| 19 |
include_str!("include_str.rs"); // ok |
| 20 |
include_str!("include_str.rs",); // trailing comma ok |
| 21 |
include_str!("invalid_utf8"); // { dg-error "invalid_utf8 was not a valid utf-8 file" "" } |
| 22 |
include_str!(my_file!()); |
| 23 |
include_str!(my_file!(),); |
| 24 |
} |