Skip to content

ICE on pattern matching Option #11844

Closed
Closed
@pfalabella

Description

@pfalabella

This program does not compile. rustc corerctly identifies my error (writing Ok instead of Some when destructuring an Option). However it also gives an ICE after the error.

fn main() {
    let a = Some(~1);
    match a {
        Ok(a) => println!("{}",a),
        None => fail!()
    }    
}

the ICE:

$ rustc error.rs
error.rs:13:9: 13:14 error: mismatched types: expected `std::option::Option<~<ge
neric integer #0>>` but found `std::result::Result<<generic #11>,<generic #12>>`
 (expected enum std::option::Option but found enum std::result::Result)
error.rs:13         Ok(a) => println!("{}",a),
                    ^~~~~
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/complem
ent-bugreport.html
note: the compiler hit an unexpected failure path. this is a bug
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', D
:\Heather\Contrib\P\rust\src\librustc\middle\typeck\check\vtable.rs:255

version of rustc

$ rustc -v
rustc.exe 0.10-pre (bf9c255 2014-01-23 19:56:35 -0800)
host: i686-pc-mingw32

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