]> git.lizzy.rs Git - rust.git/blob - src/test/ui/proc-macro/nonterminal-token-hygiene.rs
Auto merge of #106349 - LeSeulArtichaut:dyn-star-tracking-issue, r=jackh726
[rust.git] / src / test / ui / proc-macro / nonterminal-token-hygiene.rs
1 // Make sure that marks from declarative macros are applied to tokens in nonterminal.
2
3 // check-pass
4 // compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
5 // compile-flags: -Z trim-diagnostic-paths=no
6 // normalize-stdout-test "\d+#" -> "0#"
7 // normalize-stdout-test "expn\d{3,}" -> "expnNNN"
8 // aux-build:test-macros.rs
9
10 #![feature(decl_macro)]
11
12 #![no_std] // Don't load unnecessary hygiene information from std
13 extern crate std;
14
15 #[macro_use]
16 extern crate test_macros;
17
18 macro_rules! outer {
19     ($item:item) => {
20         macro inner() {
21             print_bang! { $item }
22         }
23
24         inner!();
25     };
26 }
27
28 struct S;
29
30 outer! {
31     struct S; // OK, not a duplicate definition of `S`
32 }
33
34 fn main() {}