Migrate intrinsic-unreachable test to asm!

This commit is contained in:
Tomasz Miąsko 2022-01-12 00:00:00 +00:00
parent 02e6c64a04
commit 064eda47f1
2 changed files with 5 additions and 5 deletions

View File

@ -1,12 +1,11 @@
#![feature(llvm_asm)]
#![crate_type="lib"]
use std::arch::asm;
#[deny(unreachable_code)]
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
llvm_asm!("" :: "r"(n) :: "volatile");
// Can't actually reach this point, but rustc doesn't know that.
asm!("/*{0}*/", in(reg) n);
}
// This return value is just here to generate some extra code for a return
// value, making it easier for the test script to detect whether the

View File

@ -1,5 +1,6 @@
#![feature(llvm_asm, core_intrinsics)]
#![feature(core_intrinsics)]
#![crate_type="lib"]
use std::arch::asm;
use std::intrinsics;
@ -7,7 +8,7 @@
pub fn exit(n: usize) -> i32 {
unsafe {
// Pretend this asm is an exit() syscall.
llvm_asm!("" :: "r"(n) :: "volatile");
asm!("/*{0}*/", in(reg) n);
intrinsics::unreachable()
}
// This return value is just here to generate some extra code for a return