diff --git a/src/libstd/sys/common/util.rs b/src/libstd/sys/common/util.rs index b7a6b7650d540..056069670d680 100644 --- a/src/libstd/sys/common/util.rs +++ b/src/libstd/sys/common/util.rs @@ -10,7 +10,6 @@ use env; use fmt; -use intrinsics; use io::prelude::*; use sync::atomic::{self, Ordering}; use sys::stdio::Stderr; @@ -34,7 +33,16 @@ pub fn dumb_print(args: fmt::Arguments) { let _ = Stderr::new().map(|mut stderr| stderr.write_fmt(args)); } +#[cfg(unix)] pub fn abort(args: fmt::Arguments) -> ! { + use libc; + dumb_print(format_args!("fatal runtime error: {}\n", args)); + unsafe { libc::abort(); } +} + +#[cfg(not(unix))] +pub fn abort(args: fmt::Arguments) -> ! { + use intrinsics; dumb_print(format_args!("fatal runtime error: {}\n", args)); unsafe { intrinsics::abort(); } } diff --git a/src/test/run-pass/out-of-stack.rs b/src/test/run-pass/out-of-stack.rs index 4401861a1631c..58119f965cf82 100644 --- a/src/test/run-pass/out-of-stack.rs +++ b/src/test/run-pass/out-of-stack.rs @@ -46,8 +46,7 @@ fn check_status(status: std::process::ExitStatus) use std::os::unix::process::ExitStatusExt; assert!(!status.success()); - assert!(status.signal() != Some(libc::SIGSEGV) - && status.signal() != Some(libc::SIGBUS)); + assert_eq!(status.signal(), Some(libc::SIGABRT)); } #[cfg(not(unix))]