rust/tests/run-make/intrinsic-unreachable/rmake.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
814 B
Rust
Raw Normal View History

2024-06-11 13:18:27 -05:00
// intrinsics::unreachable tells the compiler that a certain point in the code
// is not reachable by any means, which enables some useful optimizations.
// In this test, exit-unreachable contains this instruction and exit-ret does not,
// which means the emitted artifacts should be shorter in length.
// See https://github.com/rust-lang/rust/pull/16970
//@ needs-asm-support
2024-06-12 10:24:21 -05:00
//@ ignore-windows
2024-06-11 13:18:27 -05:00
// Reason: Because of Windows exception handling, the code is not necessarily any shorter.
2024-07-17 08:31:38 -05:00
use run_make_support::{rfs, rustc};
2024-06-11 13:18:27 -05:00
fn main() {
rustc().opt().emit("asm").input("exit-ret.rs").run();
rustc().opt().emit("asm").input("exit-unreachable.rs").run();
2024-06-12 10:24:21 -05:00
assert!(
rfs::read_to_string("exit-unreachable.s").lines().count()
< rfs::read_to_string("exit-ret.s").lines().count()
2024-06-12 10:24:21 -05:00
);
2024-06-11 13:18:27 -05:00
}