]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/macro-metavars-legacy.rs
Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov
[rust.git] / src / test / ui / hygiene / macro-metavars-legacy.rs
1 // Ensure macro metavariables are compared with legacy hygiene
2
3 #![feature(rustc_attrs)]
4
5 // run-pass
6
7 macro_rules! make_mac {
8     ( $($dollar:tt $arg:ident),+ ) => {
9         macro_rules! mac {
10             ( $($dollar $arg : ident),+ ) => {
11                 $( $dollar $arg )-+
12             }
13         }
14     }
15 }
16
17 macro_rules! show_hygiene {
18     ( $dollar:tt $arg:ident ) => {
19         make_mac!($dollar $arg, $dollar arg);
20     }
21 }
22
23 show_hygiene!( $arg );
24
25 fn main() {
26     let x = 5;
27     let y = 3;
28     assert_eq!(2, mac!(x, y));
29 }