Skip to content
Myr

Restore 'Stack backtrace:' above the backtrace

Before adoption: this commit came in with the history the project adopted, so no landing records it.

The header originally printed by the backtrace crate was removed in https://github.com/rust-lang/backtrace-rs/pull/286 to give downstream formatting code a chance to incorporate whatever kind of header they want. So we do that.

authored by David Tolnay · committed by David Tolnay · parent 2aa0cc1 · Browse files · 1 file+6 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−1 removed

  • other:+6 added−1 removed

1 file+6 added−1 removed

modified:src/fmt.rs+6 added-1 removed
43 unmodified lines
4445 let backtrace = self.backtrace();46 if let BacktraceStatus::Captured = backtrace.status() {47 let mut backtrace = backtrace.to_string();48 write!(f, "\n\n")?;49 if backtrace.starts_with("stack backtrace:") {50 // Capitalize to match "Caused by:"51 backtrace.replace_range(0..1, "S");52 } else {53 // "stack backtrace:" prefix was removed in54 // https://github.com/rust-lang/backtrace-rs/pull/28655 writeln!(f, "Stack backtrace:")?;56 }57 backtrace.truncate(backtrace.trim_end().len());53 write!(f, "\n\n{}", backtrace)?;58 write!(f, "{}", backtrace)?;59 }60 }6162 Ok(())
92 unmodified lines