about summary refs log tree commit diff
diff options
context:
space:
mode:
authorScott McMurray <scottmcm@users.noreply.github.com>2022-10-25 12:16:25 -0700
committerScott McMurray <scottmcm@users.noreply.github.com>2022-10-25 12:16:25 -0700
commit5064648624c94008d54a2f1d754168d1a0d1df26 (patch)
tree2d464df14acba990c00e91d0f5acfaea5ccb8450
parent1ca6777c014813e3bdb98d155562fc3d111d86dd (diff)
downloadrust-5064648624c94008d54a2f1d754168d1a0d1df26.tar.gz
rust-5064648624c94008d54a2f1d754168d1a0d1df26.zip
Pinning tests for some macro_rules things discussed in the lang meeting
-rw-r--r--src/test/ui/macros/macro_rules-unmatchable-literals.rs14
-rw-r--r--src/test/ui/macros/macro_rules-unmatchable-literals.stderr14
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/ui/macros/macro_rules-unmatchable-literals.rs b/src/test/ui/macros/macro_rules-unmatchable-literals.rs
new file mode 100644
index 00000000000..bde0fe1a015
--- /dev/null
+++ b/src/test/ui/macros/macro_rules-unmatchable-literals.rs
@@ -0,0 +1,14 @@
+// Pinning tests for things that don't work to make sure we notice if that changes
+
+#![crate_type = "lib"]
+
+macro_rules! octal_with_bad_digit {
+    ( 0o1238 ) => {}; //~ ERROR invalid digit
+}
+
+macro_rules! binary_with_bad_digit {
+    ( 0b012 ) => {}; //~ ERROR invalid digit
+}
+
+// This can't happen for Hex and Decimal as things like `123A` and `0xFFG`
+// get treated as unknown *suffixes*, rather than digits.
diff --git a/src/test/ui/macros/macro_rules-unmatchable-literals.stderr b/src/test/ui/macros/macro_rules-unmatchable-literals.stderr
new file mode 100644
index 00000000000..956a669791d
--- /dev/null
+++ b/src/test/ui/macros/macro_rules-unmatchable-literals.stderr
@@ -0,0 +1,14 @@
+error: invalid digit for a base 8 literal
+  --> $DIR/macro_rules-unmatchable-literals.rs:6:12
+   |
+LL |     ( 0o1238 ) => {};
+   |            ^
+
+error: invalid digit for a base 2 literal
+  --> $DIR/macro_rules-unmatchable-literals.rs:10:11
+   |
+LL |     ( 0b012 ) => {};
+   |           ^
+
+error: aborting due to 2 previous errors
+