diff options
| author | Jorge Aparicio <jorge@japaric.io> | 2018-05-16 14:07:58 +0200 |
|---|---|---|
| committer | Jorge Aparicio <jorge@japaric.io> | 2018-06-03 13:46:19 +0200 |
| commit | 430ad769008c0aaa40949a1d98a6f0e18e35ec65 (patch) | |
| tree | deae3f6dbdfd4fd0313086c27beac54df75ce38b /src/libcore | |
| parent | eb1936141611afa8ad9034c4093e1539df36548c (diff) | |
| download | rust-430ad769008c0aaa40949a1d98a6f0e18e35ec65.tar.gz rust-430ad769008c0aaa40949a1d98a6f0e18e35ec65.zip | |
undo payload in core::panic! changes
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/macros.rs | 22 | ||||
| -rw-r--r-- | src/libcore/panicking.rs | 32 |
2 files changed, 7 insertions, 47 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index f98626d939d..c830c22ee5f 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -9,7 +9,6 @@ // except according to those terms. /// Entry point of thread panic, for details, see std::macros -#[cfg(stage0)] #[macro_export] #[allow_internal_unstable] #[stable(feature = "core", since = "1.6.0")] @@ -29,27 +28,6 @@ macro_rules! panic { }); } -/// Entry point of thread panic, for details, see std::macros -#[cfg(not(stage0))] -#[macro_export] -#[allow_internal_unstable] -#[stable(feature = "core", since = "1.6.0")] -macro_rules! panic { - () => ( - panic!("explicit panic") - ); - ($msg:expr) => ({ - $crate::panicking::panic_payload($msg, &(file!(), line!(), __rust_unstable_column!())) - }); - ($msg:expr,) => ( - panic!($msg) - ); - ($fmt:expr, $($arg:tt)+) => ({ - $crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), - &(file!(), line!(), __rust_unstable_column!())) - }); -} - /// Asserts that two expressions are equal to each other (using [`PartialEq`]). /// /// On panic, this macro will print the values of the expressions with their diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 4b4fa73c478..0d4f8d1141e 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -36,35 +36,10 @@ and related macros", issue = "0")] -#[cfg(not(stage0))] -use any::Any; use fmt; #[cfg(not(stage0))] use panic::{Location, PanicInfo}; -// NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call -#[cfg(not(stage0))] -#[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe -extern "Rust" { - #[lang = "panic_impl"] - fn panic_impl(pi: &PanicInfo) -> !; -} - -#[cfg(not(stage0))] -#[cold] #[inline(never)] -pub fn panic_payload<M>(msg: M, file_line_col: &(&'static str, u32, u32)) -> ! -where - M: Any + Send, -{ - let (file, line, col) = *file_line_col; - let mut pi = PanicInfo::internal_constructor( - None, - Location::internal_constructor(file, line, col), - ); - pi.set_payload(&msg); - unsafe { panic_impl(&pi) } -} - #[cold] #[inline(never)] // this is the slow path, always #[lang = "panic"] pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! { @@ -102,6 +77,13 @@ pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) #[cfg(not(stage0))] #[cold] #[inline(never)] pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! { + // NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call + #[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe + extern "Rust" { + #[lang = "panic_impl"] + fn panic_impl(pi: &PanicInfo) -> !; + } + let (file, line, col) = *file_line_col; let pi = PanicInfo::internal_constructor( Some(&fmt), |
