Skip to content

Playground ICE while playing around with nasal demons #51706

Closed
@flying-sheep

Description

@flying-sheep

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions