From aec97e050ea5247fa13612399a7a812dbce89ec9 Mon Sep 17 00:00:00 2001 From: Adam Perry Date: Wed, 23 Oct 2019 19:30:21 -0700 Subject: Panicking infra uses &core::panic::Location. This allows us to remove `static_panic_msg` from the SSA<->LLVM boundary, along with its fat pointer representation for &str. Also changes the signature of PanicInfo::internal_contructor to avoid copying. Closes #65856. --- src/libstd/panicking.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/libstd') diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index 619b1820190..f76969146fd 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -323,10 +323,8 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>, } let (file, line, col) = *file_line_col; - let info = PanicInfo::internal_constructor( - Some(msg), - Location::internal_constructor(file, line, col), - ); + let location = Location::internal_constructor(file, line, col); + let info = PanicInfo::internal_constructor(Some(msg), &location); continue_panic_fmt(&info) } @@ -453,10 +451,8 @@ fn rust_panic_with_hook(payload: &mut dyn BoxMeUp, } unsafe { - let mut info = PanicInfo::internal_constructor( - message, - Location::internal_constructor(file, line, col), - ); + let location = Location::internal_constructor(file, line, col); + let mut info = PanicInfo::internal_constructor(message, &location); HOOK_LOCK.read(); match HOOK { // Some platforms know that printing to stderr won't ever actually -- cgit 1.4.1-3-g733a5