diff --git a/library/std/src/sys_common/backtrace.rs b/library/std/src/sys_common/backtrace.rs index a549770d8b378..5f6318ba5d231 100644 --- a/library/std/src/sys_common/backtrace.rs +++ b/library/std/src/sys_common/backtrace.rs @@ -71,6 +71,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: let mut hit = false; let mut stop = false; + let mut frame_fmt = bt_fmt.frame(); backtrace_rs::resolve_frame_unsynchronized(frame, |symbol| { hit = true; if print_fmt == PrintFmt::Short { @@ -87,7 +88,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: } if start { - res = bt_fmt.frame().symbol(frame, symbol); + res = frame_fmt.symbol(frame, symbol); } }); if stop { @@ -95,7 +96,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: } if !hit { if start { - res = bt_fmt.frame().print_raw(frame.ip(), None, None, None); + res = frame_fmt.print_raw(frame.ip(), None, None, None); } }