std: Use backtrace-sys from crates.io
This commit switches the standard library to using the `backtrace-sys` crate from crates.io instead of duplicating the logic here in the Rust repositor with the `backtrace-sys`'s crate's logic. Eventually this will hopefully be a good step towards using the `backtrace` crate directly from crates.io itself, but we're not quite there yet! Hopefully this is a small incremental first step we can take.
This commit is contained in:
parent
50f3d6eccb
commit
8d500572fa
9 changed files with 40 additions and 138 deletions
|
@ -53,6 +53,14 @@ const MAX_NB_FRAMES: usize = 100;
|
|||
pub fn print(w: &mut dyn Write, format: PrintFormat) -> io::Result<()> {
|
||||
static LOCK: Mutex = Mutex::new();
|
||||
|
||||
// There are issues currently linking libbacktrace into tests, and in
|
||||
// general during libstd's own unit tests we're not testing this path. In
|
||||
// test mode immediately return here to optimize away any references to the
|
||||
// libbacktrace symbols
|
||||
if cfg!(test) {
|
||||
return Ok(())
|
||||
}
|
||||
|
||||
// Use a lock to prevent mixed output in multithreading context.
|
||||
// Some platforms also requires it, like `SymFromAddr` on Windows.
|
||||
unsafe {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue