#[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}

#[rustversion::nightly]
#[test]
fn test_backtrace() {
    use anyhow::anyhow;

    let error = anyhow!("oh no!");
    let _ = error.backtrace();
}

#![cfg(not(miri))]

#[rustversion::not(nightly)]
#[ignore]
#[test]
fn test_backtrace() {}

#[rustversion::nightly]
#[test]
fn test_backtrace() {
    use anyhow::anyhow;

    let error = anyhow!("oh no!");
    let _ = error.backtrace();
}

Disable backtrace test on miri
Disable backtrace test on miri

Starting in the most recent release of miri, the build.rs probe fails to
build even on nightly toolchain with one of the following errors:

    error: miri can only run programs that have a main function

    error: the current sysroot was built without `-Zalways-encode-mir`,
    or libcore seems missing. Use `cargo miri setup` to prepare a
    sysroot that is suitable for Miri.

which causes anyhow::Error's backtrace() inherent method to not exist.

    error[E0658]: use of unstable library feature 'backtrace'
      --> tests/test_backtrace.rs:20:19
       |
    20 |     let _ = error.backtrace();
       |                   ^^^^^^^^^
       |
       = note: see issue 53487 <https://github.com/rust-lang/rust/issues/53487> for more information
       = help: add `#![feature(backtrace)]` to the crate attributes to enable
