diff --git a/src/libstd/sys_common/backtrace.rs b/src/libstd/sys_common/backtrace.rs index 191add2c31b3e..289ee07babfcf 100644 --- a/src/libstd/sys_common/backtrace.rs +++ b/src/libstd/sys_common/backtrace.rs @@ -70,6 +70,7 @@ unsafe fn _print_fmt(fmt: &mut fmt::Formatter<'_>, print_fmt: PrintFmt) -> fmt:: let mut print_path = move |fmt: &mut fmt::Formatter<'_>, bows: BytesOrWideString<'_>| { output_filename(fmt, bows, print_fmt, cwd.as_ref()) }; + write!(fmt, "stack backtrace:\n")?; let mut bt_fmt = BacktraceFmt::new(fmt, print_fmt, &mut print_path); bt_fmt.add_context()?; let mut idx = 0; diff --git a/src/test/ui/std-backtrace.rs b/src/test/ui/std-backtrace.rs index d84c493d53523..902a2b6f5a0e9 100644 --- a/src/test/ui/std-backtrace.rs +++ b/src/test/ui/std-backtrace.rs @@ -16,9 +16,9 @@ use std::str; fn main() { let args: Vec = env::args().collect(); if args.len() >= 2 && args[1] == "force" { - println!("{}", std::backtrace::Backtrace::force_capture()); + println!("stack backtrace:\n{}", std::backtrace::Backtrace::force_capture()); } else if args.len() >= 2 { - println!("{}", std::backtrace::Backtrace::capture()); + println!("stack backtrace:\n{}", std::backtrace::Backtrace::capture()); } else { runtest(&args[0]); println!("test ok");