]> git.lizzy.rs Git - rust.git/blob - tests/ui/proc-macro/meta-macro-hygiene.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / proc-macro / meta-macro-hygiene.rs
1 // aux-build:make-macro.rs
2 // aux-build:meta-macro.rs
3 // edition:2018
4 // compile-flags: -Z span-debug -Z macro-backtrace -Z unpretty=expanded,hygiene -Z trim-diagnostic-paths=no
5 // check-pass
6 // normalize-stdout-test "\d+#" -> "0#"
7 // normalize-stdout-test "expn\d{3,}" -> "expnNNN"
8 //
9 // We don't care about symbol ids, so we set them all to 0
10 // in the stdout
11
12 #![no_std] // Don't load unnecessary hygiene information from std
13 extern crate std;
14
15 extern crate meta_macro;
16
17 macro_rules! produce_it {
18     () => {
19         // `print_def_site!` will respan the `$crate` identifier
20         // with `Span::def_site()`. This should cause it to resolve
21         // relative to `meta_macro`, *not* `make_macro` (despite
22         // the fact that `print_def_site` is produced by a
23         // `macro_rules!` macro in `make_macro`).
24         meta_macro::print_def_site!($crate::dummy!());
25     }
26 }
27
28 fn main() {
29     produce_it!();
30 }