]> git.proxmox.com Git - rustc.git/blob - tests/run-make-fulldeps/intrinsic-unreachable/exit-unreachable.rs
New upstream version 1.69.0+dfsg1
[rustc.git] / tests / run-make-fulldeps / intrinsic-unreachable / exit-unreachable.rs
1 #![feature(core_intrinsics)]
2 #![crate_type="lib"]
3 use std::arch::asm;
4
5 use std::intrinsics;
6
7 #[allow(unreachable_code)]
8 pub fn exit(n: usize) -> i32 {
9 unsafe {
10 // Pretend this asm is an exit() syscall.
11 asm!("/*{0}*/", in(reg) n);
12 intrinsics::unreachable()
13 }
14 // This return value is just here to generate some extra code for a return
15 // value, making it easier for the test script to detect whether the
16 // compiler deleted it.
17 42
18 }