Skip to content

Reconsider stracktrace configurability with rust 2024 set_var changes. #403

@rukai

Description

@rukai

I know there has already been a lot of discussion on this, so my apologies for bringing it up again, but rust 2024 will change the original context this decision may have been made in.

Previously I raised #342 but then I found a workaround to disable anyhow backtrace capturing via:

if std::env::var("RUST_LIB_BACKTRACE").is_err() {
  std::env::set_var("RUST_LIB_BACKTRACE", "0");
}

This resolved my issue and the issue was closed.

However, with rust 2024, set_var will be marked unsafe.
Many high level codebases have a blanket ban on unsafe, so even if set_var can be soundly called at the start of the application before any threads are created, there is no way to create a sound wrapper API for that as it could still be called after that point.
So this approach is not usable in codebases with a blanket ban on unsafe.

Does this alter the original assumptions around the decision to "not expose a way for the application to configure whether stacktraces are captured"?
If this changes nothing go ahead and close the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions