Skip to content

Internal compiler error with unreachable nested if-expression #11865

Closed
@nmsmith

Description

@nmsmith

The following code causes a compiler error:

fn main() {
    not(true);
}

fn not(b: bool) -> bool {
    if b {
        !b
    } else {
        fail!("Break the compiler");
        if !b {

        }
    }
}

The error message:

error: internal compiler error: unexpected failure
This message reflects a bug in the Rust compiler. 
We would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: the compiler hit an unexpected failure path. this is a bug
task 'rustc' failed at 'assertion failed: dest == expr::Ignore || bcx.unreachable.get()', /home/nick/workspace/rust/src/librustc/middle/trans/controlflow.rs:91

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