]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/extern-abi-from-mac-literal-frag.rs
Rollup merge of #106441 - mllken:abstract-socket-noref, r=joshtriplett
[rust.git] / tests / ui / parser / extern-abi-from-mac-literal-frag.rs
1 #![allow(clashing_extern_declarations)]
2 // check-pass
3
4 // In this test we check that the parser accepts an ABI string when it
5 // comes from a macro `literal` or `expr` fragment as opposed to a hardcoded string.
6
7 fn main() {}
8
9 macro_rules! abi_from_lit_frag {
10     ($abi:literal) => {
11         extern $abi {
12             fn _import();
13         }
14
15         extern $abi fn _export() {}
16
17         type _PTR = extern $abi fn();
18     }
19 }
20
21 macro_rules! abi_from_expr_frag {
22     ($abi:expr) => {
23         extern $abi {
24             fn _import();
25         }
26
27         extern $abi fn _export() {}
28
29         type _PTR = extern $abi fn();
30     };
31 }
32
33 mod rust {
34     abi_from_lit_frag!("Rust");
35 }
36
37 mod c {
38     abi_from_lit_frag!("C");
39 }
40
41 mod rust_expr {
42     abi_from_expr_frag!("Rust");
43 }
44
45 mod c_expr {
46     abi_from_expr_frag!("C");
47 }