dtolnay/anyhow

Updating from version 1.0.76 breaks backtraces

Closed this issue · 2 comments

After running cargo update I noticed that backtraces have become useless. Pinning anyhow to version 1.0.76 fixes the issue.
With newer versions, the backtrace contains just <unknown> frames.

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>

Edit: To be clear, version 1.0.76 is the last one that it working. Version 1.0.77 doesn't work anymore.

Could you share the output of rustc -Vv?

Maybe you are on a platform that is not supported by std::backtrace, or the standard library has been compiled with flags that interfere with something in std::backtrace.

I did some more research and it turns out, that updating the Rust toolchain fixes the problem.
I was using version 1.73.0, which produces the issue. Using version 1.74.0 works fine.

Here is a minimal example to reproduce:

rust-toolchain.toml

[toolchain]
channel = "1.73.0"

Cargo.toml

[package]
name = "anyhow-test"
version = "0.1.0"
edition = "2021"

[dependencies]
anyhow = { version = "=1.0.77", features = ["backtrace"] }

src/main.rs

fn main() -> anyhow::Result<()> {
    anyhow::bail!("oops");
    Ok(())
}

Toolchain: 1.73.0-x86_64-unknown-linux-gnu