Skip to content

pattern guard causes assertion failure #6289

Closed
@kimhyunkang

Description

@kimhyunkang

I encountered an assertion failure in rustc 0.6

fn main() {
    let x = Some(3);
    let y = 0;

    match(x) {
        None => println("None"),
        _ if y == 0 => println("y is zero"),
        Some(n) => println(fmt!("Some(%d)", n)),
    }
}

Above is a simple test code to reproduce the bug
(Yes it is a silly code which can be rephrased into match nested in if)

kimhyunkang$ RUST_LOG=rustc=1,::rt::backtrace rustc test.rs
rust: task failed at 'assertion failed: (m.len() > 0u || chk.is_some())', /Users/kimhyunkang/usr/pkgs/rust-0.6/src/librustc/middle/trans/_match.rs:1262
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug
note: try running with RUST_LOG=rustc=1,::rt::backtrace to get further details and report the results to github.com/mozilla/rust/issues
rust: task failed at 'explicit failure', /Users/kimhyunkang/usr/pkgs/rust-0.6/src/librustc/rustc.rc:357
rust: domain main @0x7f8789819410 root task failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-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