Skip to content

Panics with cranelift on MacOS cause "fatal runtime error: failed to initiate panic, error 5" #1527

@lucasmerlin

Description

@lucasmerlin

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)

I also made a small reproduciton:
https://github.com/lucasmerlin/test_error_repro

Running cargo test outputs:

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)

Maybe related to rust-lang/rust#88622

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions