about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/type/pattern_types/macros.active.stderr10
-rw-r--r--tests/ui/type/pattern_types/macros.gated.stderr10
-rw-r--r--tests/ui/type/pattern_types/macros.rs15
3 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/type/pattern_types/macros.active.stderr b/tests/ui/type/pattern_types/macros.active.stderr
new file mode 100644
index 00000000000..002e944fe2e
--- /dev/null
+++ b/tests/ui/type/pattern_types/macros.active.stderr
@@ -0,0 +1,10 @@
+error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
+  --> $DIR/macros.rs:10:12
+   |
+LL |     ($t:ty is $p:pat) => {};
+   |            ^^ not allowed after `ty` fragments
+   |
+   = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type/pattern_types/macros.gated.stderr b/tests/ui/type/pattern_types/macros.gated.stderr
new file mode 100644
index 00000000000..002e944fe2e
--- /dev/null
+++ b/tests/ui/type/pattern_types/macros.gated.stderr
@@ -0,0 +1,10 @@
+error: `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
+  --> $DIR/macros.rs:10:12
+   |
+LL |     ($t:ty is $p:pat) => {};
+   |            ^^ not allowed after `ty` fragments
+   |
+   = note: allowed there are: `{`, `[`, `=>`, `,`, `>`, `=`, `:`, `;`, `|`, `as` or `where`
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/type/pattern_types/macros.rs b/tests/ui/type/pattern_types/macros.rs
new file mode 100644
index 00000000000..f0b351f7b27
--- /dev/null
+++ b/tests/ui/type/pattern_types/macros.rs
@@ -0,0 +1,15 @@
+//@ revisions: gated active
+
+#![cfg_attr(active, feature(pattern_types))]
+#![allow(incomplete_features)]
+
+// Check that pattern types do not affect existing macros.
+// They don't, because `is` was never legal after `ty` fragments.
+
+macro_rules! foo {
+    ($t:ty is $p:pat) => {}; //~ ERROR `$t:ty` is followed by `is`, which is not allowed for `ty` fragments
+}
+
+fn main() {
+    foo!(u32 is 1..)
+}