Auto merge of #16680 - mbrubeck:abort, r=jdm

Replace intrinsics::abort with process::abort

This removes some unsafe/unstable code and replaces it with a new safe/stable alternative.

Note that `process::abort` is not identical to `intrinsics::abort`, since it runs global cleanups to do things like flush stderr (though neither function performs stack unwinding).  I don't *think* the difference matters for our use cases.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should not change functionality

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16680)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-01 16:06:45 -05:00 committed by GitHub
commit 52920ed645
3 changed files with 4 additions and 9 deletions

View file

@ -4,7 +4,6 @@
#![allow(non_camel_case_types)] #![allow(non_camel_case_types)]
#![feature(box_syntax)] #![feature(box_syntax)]
#![feature(core_intrinsics)]
#![feature(link_args)] #![feature(link_args)]
#[macro_use] #[macro_use]

View file

@ -12,9 +12,7 @@ macro_rules! stub(
#[allow(non_snake_case)] #[allow(non_snake_case)]
pub extern "C" fn $name() { pub extern "C" fn $name() {
println!("CEF stub function called: {}", stringify!($name)); println!("CEF stub function called: {}", stringify!($name));
unsafe { ::std::process::abort()
::std::intrinsics::abort()
}
} }
) )
); );

View file

@ -15,7 +15,7 @@
//! //!
//! [glutin]: https://github.com/tomaka/glutin //! [glutin]: https://github.com/tomaka/glutin
#![feature(start, core_intrinsics)] #![feature(start)]
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
extern crate android_injected_glue; extern crate android_injected_glue;
@ -58,7 +58,7 @@ pub mod platform {
fn install_crash_handler() { fn install_crash_handler() {
use backtrace::Backtrace; use backtrace::Backtrace;
use sig::ffi::Sig; use sig::ffi::Sig;
use std::intrinsics::abort; use std::process::abort;
use std::thread; use std::thread;
fn handler(_sig: i32) { fn handler(_sig: i32) {
@ -67,10 +67,8 @@ fn install_crash_handler() {
.map(|n| format!(" for thread \"{}\"", n)) .map(|n| format!(" for thread \"{}\"", n))
.unwrap_or("".to_owned()); .unwrap_or("".to_owned());
println!("Stack trace{}\n{:?}", name, Backtrace::new()); println!("Stack trace{}\n{:?}", name, Backtrace::new());
unsafe {
abort(); abort();
} }
}
signal!(Sig::SEGV, handler); // handle segfaults signal!(Sig::SEGV, handler); // handle segfaults
signal!(Sig::ILL, handler); // handle stack overflow and unsupported CPUs signal!(Sig::ILL, handler); // handle stack overflow and unsupported CPUs