-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle non returning intrinsics (#736)
* Handle non returning intrinsics * Newline in comment * Address comments
- Loading branch information
1 parent
297c3d0
commit 3cc1174
Showing
5 changed files
with
63 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// rmc-verify-fail | ||
|
||
#![feature(core_intrinsics)] | ||
|
||
// Aborts the execution of the process | ||
// | ||
// The current implementation in Rust is to invoke an invalid instruction on | ||
// most platforms. On Unix, the process terminates with a signal like `SIGABRT`, | ||
// `SIGILL`, `SIGTRAP`, `SIGSEGV` or `SIGBUS`. | ||
// | ||
// The documentation mentions that `std::process::abort` is preferred if | ||
// possible: https://doc.rust-lang.org/core/intrinsics/fn.abort.html | ||
// In RMC, `std::process::abort` is identified as a panicking function | ||
fn main() { | ||
std::intrinsics::abort(); | ||
} |
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,13 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
// rmc-verify-fail | ||
|
||
#![feature(never_type)] | ||
|
||
// Transmutes an inhabited ZST into a uninhabited ZST | ||
// | ||
// Handled as a special case of transmute (non returning intrinsic) that | ||
// compiles but crashes at runtime, similar to calling `std::intrinsic::abort` | ||
fn main() { | ||
unsafe { std::mem::transmute::<(), !>(()) }; | ||
} |
This file was deleted.
Oops, something went wrong.