summaryrefslogtreecommitdiffstats
path: root/src/test/ui/macros/issue-41803.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/macros/issue-41803.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/macros/issue-41803.rs b/src/test/ui/macros/issue-41803.rs
new file mode 100644
index 000000000..bccfdc611
--- /dev/null
+++ b/src/test/ui/macros/issue-41803.rs
@@ -0,0 +1,23 @@
+// run-pass
+#![allow(unused_macro_rules)]
+
+/// A compile-time map from identifiers to arbitrary (heterogeneous) expressions
+macro_rules! ident_map {
+ ( $name:ident = { $($key:ident => $e:expr,)* } ) => {
+ macro_rules! $name {
+ $(
+ ( $key ) => { $e };
+ )*
+ // Empty invocation expands to nothing. Needed when the map is empty.
+ () => {};
+ }
+ };
+}
+
+ident_map!(my_map = {
+ main => 0,
+});
+
+fn main() {
+ my_map!(main);
+}