-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup blocks are declared with `bb (cleanup) = { ... }`. `Call` and `Drop` terminators take an additional argument describing the unwind action, which is one of the following: * `Continue()` * `Unreachable()` * `Termiante(reason)`, where reason is `Abi` or `InCleanup` * `Cleanup(block)` Also support resume and terminate terminators: * `Resume()` * `Terminate(reason)`
- Loading branch information
Showing
16 changed files
with
282 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// compile-flags: --crate-type=lib | ||
// edition:2021 | ||
#![feature(custom_mir, core_intrinsics)] | ||
use core::intrinsics::mir::*; | ||
|
||
// CHECK-LABEL: fn f() | ||
// CHECK: bb1 (cleanup): { | ||
// CHECK-NEXT: abort(abi); | ||
#[custom_mir(dialect = "runtime", phase = "optimized")] | ||
pub fn f() { | ||
mir!( | ||
{ | ||
Return() | ||
} | ||
bb1(cleanup) = { | ||
Terminate(Abi) | ||
} | ||
) | ||
} | ||
|
||
// CHECK-LABEL: fn g() | ||
// CHECK: bb1 (cleanup): { | ||
// CHECK-NEXT: abort(cleanup); | ||
#[custom_mir(dialect = "runtime", phase = "optimized")] | ||
pub fn g() { | ||
mir!( | ||
{ | ||
Return() | ||
} | ||
bb1(cleanup) = { | ||
Terminate(InCleanup) | ||
} | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.