You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having a failing assert (e.g. assert_eq!(1, 2);) or a panic somewhere causes fatal runtime error: failed to initiate panic, error 5 when executing with the cranelift codegen enabled.
I'm using:
MacOS 14.5
cargo 1.82.0-nightly (2f738d617 2024-08-13) (Same thing also happened with 2024-08-05)
cargo test
Finished `test` profile [unoptimized + debuginfo] target(s) in 0.01s
Running unittests src/main.rs (target/debug/deps/test_error_repro-03985647548e948b)
running 1 test
fatal runtime error: failed to initiate panic, error 5
error: test failed, to rerun pass `--bin test_error_repro`
Caused by:
process didn't exit successfully: `/Users/lucasprivat/RustroverProjects/test_error_repro/target/debug/deps/test_error_repro-03985647548e948b` (signal: 6, SIGABRT: process abort signal)
Running cargo run outputs:
cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.00s
Running `target/debug/test_error_repro`
thread 'main' panicked at src/main.rs:2:3:
assertion `left == right` failed
left: 1
right: 2
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fatal runtime error: failed to initiate panic, error 5
zsh: abort cargo run
Interestingly, the assert message is printed when running with cargo run and not when running cargo test (which is a bit annoying because it makes it difficult to figure out why the test is failing)
This is because panic=unwind isn't supported yet. For getting cargo test to print the panic message you need to pass -Cpanic=abort -Zpanic-abort-tests to rustc when compiling. For example using RUSTFLAGS. This will cause the test harness to run every test in a subprocess, such that a panic doesn't abort the entire test process and the test harness has a chance to print the test failure.
Having a failing assert (e.g.
assert_eq!(1, 2);
) or a panic somewhere causesfatal runtime error: failed to initiate panic, error 5
when executing with the cranelift codegen enabled.I'm using:
I also made a small reproduciton:
https://github.com/lucasmerlin/test_error_repro
Running
cargo test
outputs:Running
cargo run
outputs:Interestingly, the assert message is printed when running with cargo run and not when running cargo test (which is a bit annoying because it makes it difficult to figure out why the test is failing)
Maybe related to rust-lang/rust#88622
The text was updated successfully, but these errors were encountered: