Closed
Description
The following code fails to run in Miri:
fn main() {
let f: fn() -> ! = || std::process::exit(0);
f();
}
The error is
error: Miri evaluation error: invalid use of NULL pointer
--> /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/ops/function.rs:227:5
|
227 | extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Miri evaluation error: invalid use of NULL pointer
|
note: inside call to `<[closure@src/main.rs:2:24: 2:48] as std::ops::FnOnce<()>>::call_once - shim` at src/main.rs:3:5
--> src/main.rs:3:5
|
3 | f();
| ^^^
I am not entirely sure what is happening; it looks like this has something to do with the shim that is used to coerce non-capturing closures to function pointers.