Closed
Description
when encountering this comment i wanted to play around with it, resulting in this
reproduced here:
extern crate rand;
use std::intrinsics::transmute;
fn main() {
unsafe { call_me_maybe(); }
}
unsafe fn call_me_maybe() -> ! {
if rand::random() {
transmute(())
} else {
loop {}
}
}
And I get:
Compiling playground v0.0.1 (file:///playground)
thread 'main' panicked at 'called `Option::unwrap()` on a `None` value', libcore/option.rs:335:21
note: Run with `RUST_BACKTRACE=1` for a backtrace.
error: internal compiler error: unexpected panic
[…]
note: rustc 1.27.0 (3eda71b00 2018-06-19) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin