diff options
| author | bors <bors@rust-lang.org> | 2020-01-04 18:39:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-04 18:39:14 +0000 |
| commit | 760ce94c69ca510d44087291c311296f6d9ccdf5 (patch) | |
| tree | a1268072a6fad12c2758f30c8409adb3ea087c20 /src/libcore | |
| parent | cd8377d37e9bc47f9a5a982c41705a7800cbb51d (diff) | |
| parent | 0bbe11089ccdb575d3f7d5a6c83eb3d2810eef29 (diff) | |
| download | rust-760ce94c69ca510d44087291c311296f6d9ccdf5.tar.gz rust-760ce94c69ca510d44087291c311296f6d9ccdf5.zip | |
Auto merge of #67874 - Dylan-DPC:rollup-xy6bkoe, r=Dylan-DPC
Rollup of 4 pull requests Successful merges: - #67137 (libstd uses `core::panic::Location` where possible.) - #67709 (Introduce an option for disabling deduplication of diagnostics) - #67775 (Make "use $crate" a hard error) - #67812 (Tweak and extend internal BTreeMap documentation, including debug asserts.) Failed merges: r? @ghost
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/macros/mod.rs | 12 | ||||
| -rw-r--r-- | src/libcore/panicking.rs | 5 |
2 files changed, 6 insertions, 11 deletions
diff --git a/src/libcore/macros/mod.rs b/src/libcore/macros/mod.rs index 9a52823a454..0eb9e194236 100644 --- a/src/libcore/macros/mod.rs +++ b/src/libcore/macros/mod.rs @@ -1,19 +1,13 @@ #[doc(include = "panic.md")] #[macro_export] -#[allow_internal_unstable(core_panic, - // FIXME(anp, eddyb) `core_intrinsics` is used here to allow calling - // the `caller_location` intrinsic, but once `#[track_caller]` is implemented, - // `panicking::{panic, panic_fmt}` can use that instead of a `Location` argument. - core_intrinsics, - const_caller_location, -)] +#[allow_internal_unstable(core_panic, track_caller)] #[stable(feature = "core", since = "1.6.0")] macro_rules! panic { () => ( $crate::panic!("explicit panic") ); ($msg:expr) => ( - $crate::panicking::panic($msg, $crate::intrinsics::caller_location()) + $crate::panicking::panic($msg) ); ($msg:expr,) => ( $crate::panic!($msg) @@ -21,7 +15,7 @@ macro_rules! panic { ($fmt:expr, $($arg:tt)+) => ( $crate::panicking::panic_fmt( $crate::format_args!($fmt, $($arg)+), - $crate::intrinsics::caller_location(), + $crate::panic::Location::caller(), ) ); } diff --git a/src/libcore/panicking.rs b/src/libcore/panicking.rs index 7ebb72e3ce7..61b764f2d62 100644 --- a/src/libcore/panicking.rs +++ b/src/libcore/panicking.rs @@ -36,8 +36,9 @@ use crate::panic::{Location, PanicInfo}; // never inline unless panic_immediate_abort to avoid code // bloat at the call sites as much as possible #[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))] +#[track_caller] #[lang = "panic"] // needed by codegen for panic on overflow and other `Assert` MIR terminators -pub fn panic(expr: &str, location: &Location<'_>) -> ! { +pub fn panic(expr: &str) -> ! { if cfg!(feature = "panic_immediate_abort") { unsafe { super::intrinsics::abort() } } @@ -48,7 +49,7 @@ pub fn panic(expr: &str, location: &Location<'_>) -> ! { // truncation and padding (even though none is used here). Using // Arguments::new_v1 may allow the compiler to omit Formatter::pad from the // output binary, saving up to a few kilobytes. - panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), location) + panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), Location::caller()) } #[cold] |
