Skip to content

Commit f5c9d56

Browse files
committed
std: Funnel all aborts through rtabort! cc rust-lang#31519
1 parent 8694b4f commit f5c9d56

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

src/libstd/panicking.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use io::prelude::*;
1414
use any::Any;
1515
use cell::Cell;
1616
use cell::RefCell;
17-
use intrinsics;
1817
use sync::StaticRwLock;
1918
use sync::atomic::{AtomicBool, Ordering};
2019
use sys::stdio::Stderr;
@@ -208,9 +207,8 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
208207
// abort immediately to avoid infinite recursion, so that attaching a
209208
// debugger provides a useable stacktrace.
210209
if panics >= 3 {
211-
util::dumb_print(format_args!("thread panicked while processing \
212-
panic. aborting.\n"));
213-
unsafe { intrinsics::abort() }
210+
rtabort!("thread panicked while processing \
211+
panic. aborting.");
214212
}
215213

216214
let info = PanicInfo {
@@ -234,8 +232,7 @@ pub fn on_panic(obj: &(Any+Send), file: &'static str, line: u32) {
234232
// have limited options. Currently our preference is to
235233
// just abort. In the future we may consider resuming
236234
// unwinding or otherwise exiting the thread cleanly.
237-
util::dumb_print(format_args!("thread panicked while panicking. \
238-
aborting.\n"));
239-
unsafe { intrinsics::abort() }
235+
rtabort!("thread panicked while panicking. \
236+
aborting.");
240237
}
241238
}

src/libstd/sys/common/unwind/seh.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,5 +149,5 @@ mod imp {
149149
#[lang = "eh_personality"]
150150
#[cfg(not(test))]
151151
fn rust_eh_personality() {
152-
unsafe { ::intrinsics::abort() }
152+
rtabort!()
153153
}

src/libstd/sys/unix/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,12 @@ pub fn init() {
7373
// errors are ignored while printing since there's nothing we can do about
7474
// them and we are about to exit anyways.
7575
fn oom_handler() -> ! {
76-
use intrinsics;
7776
let msg = "fatal runtime error: out of memory\n";
7877
unsafe {
7978
libc::write(libc::STDERR_FILENO,
8079
msg.as_ptr() as *const libc::c_void,
8180
msg.len() as libc::size_t);
82-
intrinsics::abort();
81+
rtabort!();
8382
}
8483
}
8584

src/libstd/sys/windows/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ pub fn init() {
4848

4949
// See comment in sys/unix/mod.rs
5050
fn oom_handler() -> ! {
51-
use intrinsics;
5251
use ptr;
5352
let msg = "fatal runtime error: out of memory\n";
5453
unsafe {
@@ -59,7 +58,7 @@ pub fn init() {
5958
msg.len() as c::DWORD,
6059
ptr::null_mut(),
6160
ptr::null_mut());
62-
intrinsics::abort();
61+
rtabort!();
6362
}
6463
}
6564
}

0 commit comments

Comments
 (0)