Skip to content

-Zmiri-env-forward=RUST_BACKTRACE hint is not very helpful #3838

Description

@clarfonthey

Let me explain the order of operations I went through:

  1. Run cargo miri test. Realise there are no backtraces.
  2. I try again with env RUST_BACKTRACE=1 cargo miri test.
  3. This still doesn't work. I double-check the output and I get this little nugget:
    note: in Miri, you may have to set `-Zmiri-env-forward=RUST_BACKTRACE` for the environment variable to have an effect
    
  4. env RUST_BACKTRACE=1 cargo miri test -Zmiri-env-forward=RUST_BACKTRACE
  5. error: unknown `-Z` flag specified: miri-env-forward
    
    For available unstable features, see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html
    If you intended to use an unstable rustc feature, try setting `RUSTFLAGS="-Zmiri-env-forward"
    
  6. env RUST_BACKTRACE=1 RUSTFLAGS=-Zmiri-env-forward=RUST_BACKTRACE cargo miri test
  7. Still doesn't work. At this point, I have to search for -Zmiri-env-forward and ultimately stumble on the readme for this repo mentioning I should use MIRIFLAGS, not RUSTFLAGS.

This is… very frustrating. Not to mention I have a particularly large test suite I was running this on, and miri was running all tests by default, and it was quite slow between each step. It would be nice if any of the following applied:

  1. RUST_BACKTRACE was just special and always passed to miri, at least via cargo miri.
  2. cargo miri accepted -Z flags to be passed directly to miri.
  3. The comment mentioning RUST_BACKTRACE=1 just explicitly said RUST_BACKTRACE=1 MIRIFLAGS=-Zmiri-env-forward=RUST_BACKTRACE.

This could potentially also be a cargo change, but since this message is being generated by miri itself, I figured I'd start here first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions