Update the "[run-make] run-make/intrinsic-unreachable" test.
With rustc now emitting "ud2" on unreachable code, a "return nothing" sequence may take the same number of lines as an "unreachable" sequence in assembly code. This test is testing that intrinsics::unreachable() works by testing that it reduces the number of lines in the assembly code. Fix it by adding a return value, which requires an extra instruction in the reachable case, which provides the test what it's looking for.
This commit is contained in:
parent
89652d66c9
commit
626d93b86d
@ -11,10 +11,12 @@
|
||||
#![feature(asm)]
|
||||
#![crate_type="lib"]
|
||||
|
||||
pub fn exit(n: usize) {
|
||||
#[deny(unreachable_code)]
|
||||
pub fn exit(n: usize) -> i32 {
|
||||
unsafe {
|
||||
// Pretend this asm is an exit() syscall.
|
||||
asm!("" :: "r"(n) :: "volatile");
|
||||
// Can't actually reach this point, but rustc doesn't know that.
|
||||
}
|
||||
42
|
||||
}
|
||||
|
@ -13,10 +13,12 @@
|
||||
|
||||
use std::intrinsics;
|
||||
|
||||
pub fn exit(n: usize) -> ! {
|
||||
#[allow(unreachable_code)]
|
||||
pub fn exit(n: usize) -> i32 {
|
||||
unsafe {
|
||||
// Pretend this asm is an exit() syscall.
|
||||
asm!("" :: "r"(n) :: "volatile");
|
||||
intrinsics::unreachable()
|
||||
}
|
||||
42
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user