]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/nonterminal-expansion.rs
Rollup merge of #105526 - Xiretza:iter-from-generator-derive, r=scottmcm
[rust.git] / tests / ui / proc-macro / nonterminal-expansion.rs
1 // check-pass
2 // compile-flags: -Z span-debug
3 // aux-build:test-macros.rs
4
5 #![no_std] // Don't load unnecessary hygiene information from std
6 extern crate std;
7
8 #[macro_use]
9 extern crate test_macros;
10
11 macro_rules! pass_nonterminal {
12     ($line:expr) => {
13         #[print_attr_args(a, $line, b)]
14         struct S;
15     };
16 }
17
18 // `line!()` is not expanded before it's passed to the proc macro.
19 pass_nonterminal!(line!());
20
21 // Test case from #43860.
22
23 #[macro_export]
24 macro_rules! use_contract {
25     ($name: ident, $path: expr) => {
26         #[derive(Empty)]
27         #[empty_helper(path = $path)] // OK
28         pub struct $name<T, C> {
29             api: T,
30             contract: C,
31         }
32     };
33 }
34
35 use_contract!(ContractName, file!());
36
37 fn main() {}