2020-11-03 18:13:11 +00:00
|
|
|
// Make sure that marks from declarative macros are applied to tokens in nonterminal.
|
|
|
|
|
|
|
|
// check-pass
|
2020-11-05 21:36:30 +00:00
|
|
|
// compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene
|
|
|
|
// compile-flags: -Z trim-diagnostic-paths=no
|
2023-07-29 21:44:17 +00:00
|
|
|
// ignore-tidy-linelength
|
2020-11-05 21:36:30 +00:00
|
|
|
// normalize-stdout-test "\d+#" -> "0#"
|
2021-09-24 23:27:00 +00:00
|
|
|
// normalize-stdout-test "expn\d{3,}" -> "expnNNN"
|
2023-07-29 21:44:17 +00:00
|
|
|
// normalize-stdout-test "extern crate compiler_builtins /\* \d+ \*/" -> "extern crate compiler_builtins /* NNN */"
|
2020-11-03 18:13:11 +00:00
|
|
|
// aux-build:test-macros.rs
|
|
|
|
|
|
|
|
#![feature(decl_macro)]
|
2020-11-05 21:36:30 +00:00
|
|
|
#![no_std] // Don't load unnecessary hygiene information from std
|
|
|
|
extern crate std;
|
|
|
|
|
2020-11-03 18:13:11 +00:00
|
|
|
#[macro_use]
|
|
|
|
extern crate test_macros;
|
|
|
|
|
|
|
|
macro_rules! outer {
|
|
|
|
($item:item) => {
|
|
|
|
macro inner() {
|
2020-11-05 21:36:30 +00:00
|
|
|
print_bang! { $item }
|
2020-11-03 18:13:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inner!();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
outer! {
|
|
|
|
struct S; // OK, not a duplicate definition of `S`
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|