summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/building/custom/unwind_action.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-19 09:26:03 +0000
commit9918693037dce8aa4bb6f08741b6812923486c18 (patch)
tree21d2b40bec7e6a7ea664acee056eb3d08e15a1cf /tests/mir-opt/building/custom/unwind_action.rs
parentReleasing progress-linux version 1.75.0+dfsg1-5~progress7.99u1. (diff)
downloadrustc-9918693037dce8aa4bb6f08741b6812923486c18.tar.xz
rustc-9918693037dce8aa4bb6f08741b6812923486c18.zip
Merging upstream version 1.76.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/mir-opt/building/custom/unwind_action.rs')
-rw-r--r--tests/mir-opt/building/custom/unwind_action.rs68
1 files changed, 68 insertions, 0 deletions
diff --git a/tests/mir-opt/building/custom/unwind_action.rs b/tests/mir-opt/building/custom/unwind_action.rs
new file mode 100644
index 000000000..e3c4ffac3
--- /dev/null
+++ b/tests/mir-opt/building/custom/unwind_action.rs
@@ -0,0 +1,68 @@
+// compile-flags: --crate-type=lib
+// edition:2021
+// needs-unwind
+#![feature(custom_mir, core_intrinsics)]
+use core::intrinsics::mir::*;
+
+// CHECK-LABEL: fn a()
+// CHECK: bb0: {
+// CHECK-NEXT: a() -> [return: bb1, unwind unreachable];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn a() {
+ mir!(
+ {
+ Call(RET = a(), bb1, UnwindUnreachable())
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn b()
+// CHECK: bb0: {
+// CHECK-NEXT: b() -> [return: bb1, unwind continue];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn b() {
+ mir!(
+ {
+ Call(RET = b(), bb1, UnwindContinue())
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn c()
+// CHECK: bb0: {
+// CHECK-NEXT: c() -> [return: bb1, unwind terminate(abi)];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn c() {
+ mir!(
+ {
+ Call(RET = c(), bb1, UnwindTerminate(ReasonAbi))
+ }
+ bb1 = {
+ Return()
+ }
+ )
+}
+
+// CHECK-LABEL: fn d()
+// CHECK: bb0: {
+// CHECK-NEXT: d() -> [return: bb1, unwind: bb2];
+#[custom_mir(dialect = "runtime", phase = "optimized")]
+pub fn d() {
+ mir!(
+ {
+ Call(RET = d(), bb1, UnwindCleanup(bb2))
+ }
+ bb1 = {
+ Return()
+ }
+ bb2 (cleanup) = {
+ UnwindResume()
+ }
+ )
+}