This repository was archived by the owner on May 28, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-13
lines changed
tests/run-make/intrinsic-unreachable Expand file tree Collapse file tree 3 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,6 @@ run-make/foreign-rust-exceptions/Makefile
47
47
run-make/incr-add-rust-src-component/Makefile
48
48
run-make/incr-foreign-head-span/Makefile
49
49
run-make/interdependent-c-libraries/Makefile
50
- run-make/intrinsic-unreachable/Makefile
51
50
run-make/issue-107094/Makefile
52
51
run-make/issue-109934-lto-debuginfo/Makefile
53
52
run-make/issue-14698/Makefile
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments