about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2020-10-03 14:48:01 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2020-10-03 14:53:09 -0700
commita5f083133e698adefe11b9e8956387d5b4c99548 (patch)
tree1ce10488158e3fe6b8b6a4cdfd534d69b877e998
parent98a2292919147d775ec196f42fe821b600180019 (diff)
downloadrust-a5f083133e698adefe11b9e8956387d5b4c99548.tar.gz
rust-a5f083133e698adefe11b9e8956387d5b4c99548.zip
Add check-pass test for `#[unwind(aborts)]` on a `const fn`
-rw-r--r--src/test/ui/consts/unwind-abort.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/consts/unwind-abort.rs b/src/test/ui/consts/unwind-abort.rs
new file mode 100644
index 00000000000..f9011f908a7
--- /dev/null
+++ b/src/test/ui/consts/unwind-abort.rs
@@ -0,0 +1,17 @@
+// check-pass
+
+#![feature(unwind_attributes, const_panic)]
+
+// `#[unwind(aborts)]` is okay for a `const fn`. We don't unwind in const-eval anyways.
+#[unwind(aborts)]
+const fn foo() {
+    panic!()
+}
+
+const fn bar() {
+    foo();
+}
+
+fn main() {
+    bar();
+}