Skip to content

Commit be4f05f

Browse files
committed
rewrite intrinsic-unreachable to rmake
1 parent b6e5e3f commit be4f05f

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

src/tools/tidy/src/allowed_run_make_makefiles.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ run-make/incremental-debugger-visualizer/Makefile
7474
run-make/incremental-session-fail/Makefile
7575
run-make/inline-always-many-cgu/Makefile
7676
run-make/interdependent-c-libraries/Makefile
77-
run-make/intrinsic-unreachable/Makefile
7877
run-make/invalid-library/Makefile
7978
run-make/invalid-so/Makefile
8079
run-make/invalid-staticlib/Makefile

tests/run-make/intrinsic-unreachable/Makefile

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// intrinsics::unreachable tells the compiler that a certain point in the code
2+
// is not reachable by any means, which enables some useful optimizations.
3+
// In this test, exit-unreachable contains this instruction and exit-ret does not,
4+
// which means the emitted artifacts should be shorter in length.
5+
// See https://github.com/rust-lang/rust/pull/16970
6+
7+
//@ needs-asm-support
8+
//@ ignore-windows-msvc
9+
// Reason: Because of Windows exception handling, the code is not necessarily any shorter.
10+
11+
use run_make_support::rustc;
12+
use std::io::BufReader;
13+
use std::fs::File;
14+
15+
fn main() {
16+
rustc().opt().emit("asm").input("exit-ret.rs").run();
17+
rustc().opt().emit("asm").input("exit-unreachable.rs").run();
18+
assert!(BufReader::new(File::open("exit-unreachable.s")).lines().count() < BufReader::new(File::open("exit-ret.s")).lines().count());
19+
}

0 commit comments

Comments
 (0)