Rollup merge of #22347 - iKevinY:std-lib-panicking, r=brson
Rename `libstd/failure.rs` to `libstd/panicking.rs` and `on_fail` to `on_panic`. Closes #22306.
This commit is contained in:
commit
e5659eaa06
|
@ -279,7 +279,7 @@ pub mod sync;
|
||||||
#[path = "sys/common/mod.rs"] mod sys_common;
|
#[path = "sys/common/mod.rs"] mod sys_common;
|
||||||
|
|
||||||
pub mod rt;
|
pub mod rt;
|
||||||
mod failure;
|
mod panicking;
|
||||||
|
|
||||||
// Documentation for primitive types
|
// Documentation for primitive types
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ use self::StdSource::*;
|
||||||
use boxed::Box;
|
use boxed::Box;
|
||||||
use cell::RefCell;
|
use cell::RefCell;
|
||||||
use clone::Clone;
|
use clone::Clone;
|
||||||
use failure::LOCAL_STDERR;
|
use panicking::LOCAL_STDERR;
|
||||||
use fmt;
|
use fmt;
|
||||||
use old_io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer,
|
use old_io::{Reader, Writer, IoResult, IoError, OtherIoError, Buffer,
|
||||||
standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
|
standard_error, EndOfFile, LineBufferedWriter, BufferedReader};
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl Writer for Stdio {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn on_fail(obj: &(Any+Send), file: &'static str, line: uint) {
|
pub fn on_panic(obj: &(Any+Send), file: &'static str, line: uint) {
|
||||||
let msg = match obj.downcast_ref::<&'static str>() {
|
let msg = match obj.downcast_ref::<&'static str>() {
|
||||||
Some(s) => *s,
|
Some(s) => *s,
|
||||||
None => match obj.downcast_ref::<String>() {
|
None => match obj.downcast_ref::<String>() {
|
|
@ -62,7 +62,7 @@ use prelude::v1::*;
|
||||||
use any::Any;
|
use any::Any;
|
||||||
use cell::Cell;
|
use cell::Cell;
|
||||||
use cmp;
|
use cmp;
|
||||||
use failure;
|
use panicking;
|
||||||
use fmt;
|
use fmt;
|
||||||
use intrinsics;
|
use intrinsics;
|
||||||
use libc::c_void;
|
use libc::c_void;
|
||||||
|
@ -534,10 +534,10 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) ->
|
||||||
/// }` from ~1900/3700 (-O/no opts) to 180/590.
|
/// }` from ~1900/3700 (-O/no opts) to 180/590.
|
||||||
#[inline(never)] #[cold] // this is the slow path, please never inline this
|
#[inline(never)] #[cold] // this is the slow path, please never inline this
|
||||||
fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> ! {
|
fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> ! {
|
||||||
// Make sure the default failure handler is registered before we look at the
|
// Make sure the default panic handler is registered before we look at the
|
||||||
// callbacks.
|
// callbacks.
|
||||||
static INIT: Once = ONCE_INIT;
|
static INIT: Once = ONCE_INIT;
|
||||||
INIT.call_once(|| unsafe { register(failure::on_fail); });
|
INIT.call_once(|| unsafe { register(panicking::on_panic); });
|
||||||
|
|
||||||
// First, invoke call the user-defined callbacks triggered on thread panic.
|
// First, invoke call the user-defined callbacks triggered on thread panic.
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue