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