about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTshepang Mbambo <tshepang@gmail.com>2024-02-18 22:51:19 +0200
committerTshepang Mbambo <tshepang@gmail.com>2024-02-18 22:51:19 +0200
commit9f614cb1a08611df0a6c8d3b47de632904d7626e (patch)
tree09b7ff4ee04579e616643ffa638023f20e24e809
parent23a3d777c8a95715977608c827de63e7738fa228 (diff)
downloadrust-9f614cb1a08611df0a6c8d3b47de632904d7626e.tar.gz
rust-9f614cb1a08611df0a6c8d3b47de632904d7626e.zip
add test for panicking attribute macros
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.rs8
-rw-r--r--tests/ui/proc-macro/custom-attr-panic.stderr10
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/proc-macro/custom-attr-panic.rs b/tests/ui/proc-macro/custom-attr-panic.rs
new file mode 100644
index 00000000000..23bcb66319d
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.rs
@@ -0,0 +1,8 @@
+//@ aux-build: test-macros.rs
+
+extern crate test_macros;
+
+#[test_macros::panic_attr] //~ ERROR custom attribute panicked
+fn foo() {}
+
+fn main() {}
diff --git a/tests/ui/proc-macro/custom-attr-panic.stderr b/tests/ui/proc-macro/custom-attr-panic.stderr
new file mode 100644
index 00000000000..e436162bcc1
--- /dev/null
+++ b/tests/ui/proc-macro/custom-attr-panic.stderr
@@ -0,0 +1,10 @@
+error: custom attribute panicked
+  --> $DIR/custom-attr-panic.rs:5:1
+   |
+LL | #[test_macros::panic_attr]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+   = help: message: panic-attr
+
+error: aborting due to 1 previous error
+