Skip to content

Commit

Permalink
rewrite intrinsic-unreachable to rmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Oneirical committed Jul 8, 2024
1 parent 59a4f02 commit a4c72b6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/tools/tidy/src/allowed_run_make_makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ run-make/foreign-rust-exceptions/Makefile
run-make/incr-add-rust-src-component/Makefile
run-make/incr-foreign-head-span/Makefile
run-make/interdependent-c-libraries/Makefile
run-make/intrinsic-unreachable/Makefile
run-make/issue-107094/Makefile
run-make/issue-109934-lto-debuginfo/Makefile
run-make/issue-14698/Makefile
Expand Down
12 changes: 0 additions & 12 deletions tests/run-make/intrinsic-unreachable/Makefile

This file was deleted.

19 changes: 19 additions & 0 deletions tests/run-make/intrinsic-unreachable/rmake.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// 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
//@ ignore-windows-msvc
// Reason: Because of Windows exception handling, the code is not necessarily any shorter.

use run_make_support::rustc;
use std::io::BufReader;
use std::fs::File;

fn main() {
rustc().opt().emit("asm").input("exit-ret.rs").run();
rustc().opt().emit("asm").input("exit-unreachable.rs").run();
assert!(BufReader::new(File::open("exit-unreachable.s")).lines().count() < BufReader::new(File::open("exit-ret.s")).lines().count());
}

0 comments on commit a4c72b6

Please sign in to comment.