summaryrefslogtreecommitdiff
path: root/samples
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2018-02-24 09:20:42 +0800
committerJohn Hodge <tpg@ucc.asn.au>2018-02-24 09:20:42 +0800
commitc254e048393c4fdcf3122e6f52f925577399b390 (patch)
treed37a6aa63ddf747484ed4cf079c37e245739ae38 /samples
parent301de6f2baadbc78f270f85d488a85f75d6caacd (diff)
downloadmrust-c254e048393c4fdcf3122e6f52f925577399b390.tar.gz
macro_rules - Fix #59 and add tests for various macro quirks
Diffstat (limited to 'samples')
-rw-r--r--samples/test/misc_macro_issues.rs33
1 files changed, 33 insertions, 0 deletions
diff --git a/samples/test/misc_macro_issues.rs b/samples/test/misc_macro_issues.rs
new file mode 100644
index 00000000..4d884166
--- /dev/null
+++ b/samples/test/misc_macro_issues.rs
@@ -0,0 +1,33 @@
+// compile-flags: --test
+
+// #55 - Doesn't allow macros for :item
+macro_rules! outer {
+ ($it:item) => {}
+}
+outer! {
+ inner! {}
+}
+
+// #59 -
+macro_rules! outer2 {
+ ({ $($x:item)* }) => {}
+}
+outer2! {
+ {inner!{}}
+}
+
+
+// #56 - Unexpanded macro in type
+macro_rules! m {
+ ($tt:tt) => { $tt }
+}
+
+struct A;
+struct B;
+
+impl From<m!(A)> for B {
+ fn from(_: A) -> B {
+ unimplemented!()
+ }
+}
+