aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/macros/builtin/include_bytes.rs
blob: 3ea28133871ebebefae326ff074d1ea465cacc8f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#![feature(rustc_attrs)]

#[rustc_builtin_macro]
macro_rules! include_bytes {
    () => {{}};
}

macro_rules! file1 {
    () => {"file"};
}

static MY_FILE: &[u32;16] = include_bytes!(file!());

fn main() {
    let file = "include.txt";
    include_bytes!(file); // { dg-error "argument must be a string literal" "" }
    include_bytes!(); // { dg-error "macro takes 1 argument" "" }
    include_bytes!("foo.txt", "bar.txt"); // { dg-error "macro takes 1 argument" "" }
    include_bytes!("include_bytes.rs"); // ok
    include_bytes!("include_bytes.rs",); // trailing comma ok
    include_bytes! (file1!());
    include_bytes! (file1!(),); // trailing comma ok
}