about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/macros/unknown-builtin.stderr2
-rw-r--r--src/test/ui/matches_macro_imported.rs13
-rw-r--r--src/test/ui/matches_macro_not_in_the_prelude.rs7
-rw-r--r--src/test/ui/matches_macro_not_in_the_prelude.stderr8
4 files changed, 29 insertions, 1 deletions
diff --git a/src/test/ui/macros/unknown-builtin.stderr b/src/test/ui/macros/unknown-builtin.stderr
index 33b7b055b4e..27992b466ba 100644
--- a/src/test/ui/macros/unknown-builtin.stderr
+++ b/src/test/ui/macros/unknown-builtin.stderr
@@ -5,7 +5,7 @@ LL | macro_rules! unknown { () => () }
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: cannot find a built-in macro with name `line`
-  --> <::core::macros::builtin::line macros>:1:1
+  --> <::core::prelude_macros::builtin::line macros>:1:1
    |
 LL | () => { }
    | ^^^^^^^^^
diff --git a/src/test/ui/matches_macro_imported.rs b/src/test/ui/matches_macro_imported.rs
new file mode 100644
index 00000000000..76b7e692cee
--- /dev/null
+++ b/src/test/ui/matches_macro_imported.rs
@@ -0,0 +1,13 @@
+// run-pass
+
+#![feature(matches_macro)]
+
+use std::macros::matches;
+
+fn main() {
+    let foo = 'f';
+    assert!(matches!(foo, 'A'..='Z' | 'a'..='z'));
+
+    let foo = '_';
+    assert!(!matches!(foo, 'A'..='Z' | 'a'..='z'));
+}
diff --git a/src/test/ui/matches_macro_not_in_the_prelude.rs b/src/test/ui/matches_macro_not_in_the_prelude.rs
new file mode 100644
index 00000000000..489c7b86645
--- /dev/null
+++ b/src/test/ui/matches_macro_not_in_the_prelude.rs
@@ -0,0 +1,7 @@
+#![feature(matches_macro)]
+
+fn main() {
+    let foo = 'f';
+    assert!(matches!(foo, 'A'..='Z' | 'a'..='z'));
+    //~^ Error: cannot find macro `matches` in this scope
+}
diff --git a/src/test/ui/matches_macro_not_in_the_prelude.stderr b/src/test/ui/matches_macro_not_in_the_prelude.stderr
new file mode 100644
index 00000000000..0abe29a835b
--- /dev/null
+++ b/src/test/ui/matches_macro_not_in_the_prelude.stderr
@@ -0,0 +1,8 @@
+error: cannot find macro `matches` in this scope
+  --> $DIR/matches_macro_not_in_the_prelude.rs:5:13
+   |
+LL |     assert!(matches!(foo, 'A'..='Z' | 'a'..='z'));
+   |             ^^^^^^^
+
+error: aborting due to previous error
+