Skip to content

By default, RUST_BACKTRACE=1 silently has no effect on Miri, even though it is suggested in panic messages #2855

Closed
rust-lang/rust
#124116
@matthiaskrgr

Description

@matthiaskrgr

cc rust-lang/rust#98112
cc @saethlin

Code from the pr

fn main() {
    let mut x = [0u32; 2];
    let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>();
    unsafe {
        *(ptr.add(1).cast::<u32>()) = 42;
    }
}

run with RUST_BACKTRACE=1 ~/.cargo/bin/cargo miri run seems to not print any backtrace disregarding what the panic output suggests:

Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
    Finished dev [unoptimized + debuginfo] target(s) in 0.00s
     Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/f`
thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x4 but is 0x278b1', src/main.rs:5:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticserrors and warnings emitted by miriC-enhancementCategory: a PR with an enhancement or an issue tracking an accepted enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions