]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/panicking.rs
Rollup merge of #68326 - ollie27:rustdoc_hightlight_fatal_errors, r=GuillaumeGomez
[rust.git] / src / libcore / panicking.rs
index 7ebb72e3ce7bae73b0377f7a59e3325860f7cf34..61b764f2d6206ad7773ede553601ea130ce968d1 100644 (file)
@@ -36,8 +36,9 @@
 // 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]