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 @@ -72,7 +72,6 @@ run-make/incremental-debugger-visualizer/Makefile
72
72
run-make/incremental-session-fail/Makefile
73
73
run-make/inline-always-many-cgu/Makefile
74
74
run-make/interdependent-c-libraries/Makefile
75
- run-make/intrinsic-unreachable/Makefile
76
75
run-make/invalid-library/Makefile
77
76
run-make/invalid-so/Makefile
78
77
run-make/invalid-staticlib/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