We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
The text was updated successfully, but these errors were encountered:
The rand::random() doesn't seem to matter, this also crashes:
rand::random()
unsafe fn dont_call_me() -> ! { std::mem::transmute(()) } fn main() { unsafe { dont_call_me() } }
Playground
Sorry, something went wrong.
This is fixed on Nightly (by #50803). It instead results in undefined behaviour, as expected.
No branches or pull requests
when encountering this comment i wanted to play around with it, resulting in this
reproduced here:
And I get:
The text was updated successfully, but these errors were encountered: