]> git.lizzy.rs Git - rust.git/blob - src/test/ui/macros/issue-41803.rs
RustWrapper: simplify removing attributes
[rust.git] / src / test / ui / macros / issue-41803.rs
1 // run-pass
2 /// A compile-time map from identifiers to arbitrary (heterogeneous) expressions
3 macro_rules! ident_map {
4     ( $name:ident = { $($key:ident => $e:expr,)* } ) => {
5         macro_rules! $name {
6             $(
7                 ( $key ) => { $e };
8             )*
9             // Empty invocation expands to nothing. Needed when the map is empty.
10             () => {};
11         }
12     };
13 }
14
15 ident_map!(my_map = {
16     main => 0,
17 });
18
19 fn main() {
20     my_map!(main);
21 }