]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/issue-41803.rs
Rollup merge of #42006 - jseyfried:fix_include_regression, r=nrc
[rust.git] / src / test / run-pass / issue-41803.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 /// A compile-time map from identifiers to arbitrary (heterogeneous) expressions
12 macro_rules! ident_map {
13     ( $name:ident = { $($key:ident => $e:expr,)* } ) => {
14         macro_rules! $name {
15             $(
16                 ( $key ) => { $e };
17             )*
18             // Empty invocation expands to nothing. Needed when the map is empty.
19             () => {};
20         }
21     };
22 }
23
24 ident_map!(my_map = {
25     main => 0,
26 });
27
28 fn main() {
29     my_map!(main);
30 }