Closed MarijnS95 closed 1 year ago
I'm not comfortable having the stack trace collection of this crate be dependent on a rust specific environment variable. This is a feature of this crate and should thus be controlled by us / users of this crate directly from code.
@Jasper-Bekkers the comment exactly explains that that is the reason that Backtrace::force_capture()
is used over Backtrace::capture()
, because the former ignores Rust-specific environment variables. I see now that that comment wasn't super clear, so I've completely rewritten that paragraph, thanks for highlighting this :+1:
Sticking to my promise of updating and submitting this old branch in #183.
Fixes #183 (by no longer using the
backrace
/cc
crate); Fixes #184 (the old approach from that branch).Rust 1.65 stabilized
std::backtrace::Backtrace
, which we can use in place of thebacktrace
crate to reduce our dependency stack.Normally
Backtrace::capture()
would listen to theRUST_BACKTRACE
andRUST_LIB_BACKTRACE
environment variables, but this is unsuitable for us as capturing backtraces is configured via boolean debug feature flags in theAllocatorDebugSettings
struct. FortunatelyBacktrace::force_capture()
exists which circumvents these env var checks and always returns a backtrace, and is hence used in the codebase here.Unfortuantely the type no longer implements
Clone
likebacktrace::Backtrace
, requiring us to wrap it in anArc
(because most of our types are thread-safe) to clone theBacktrace
around various (sub)allocations and statistics reports.