Use black_box intrinsic in out-of-stack test

This commit is contained in:
Tomasz Miąsko 2022-01-12 00:00:00 +00:00
parent c7d591dc28
commit 0b315250b8

View File

@ -6,7 +6,7 @@
// ignore-emscripten no processes
// ignore-sgx no processes
#![feature(llvm_asm)]
#![feature(core_intrinsics)]
#![feature(rustc_private)]
#[cfg(unix)]
@ -16,11 +16,10 @@ use std::env;
use std::process::Command;
use std::thread;
// lifted from the test module
// Inlining to avoid llvm turning the recursive functions into tail calls,
// which doesn't consume stack.
#[inline(always)]
pub fn black_box<T>(dummy: T) { unsafe { llvm_asm!("" : : "r"(&dummy)) } }
pub fn black_box<T>(dummy: T) { std::intrinsics::black_box(dummy); }
fn silent_recurse() {
let buf = [0u8; 1000];