Skip to content
New issue

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

ICE on pattern matching Option #11844

Closed
pfalabella opened this issue Jan 27, 2014 · 1 comment
Closed

ICE on pattern matching Option #11844

pfalabella opened this issue Jan 27, 2014 · 1 comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pfalabella
Copy link
Contributor

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
@isabelmu
Copy link
Contributor

isabelmu commented Feb 3, 2014

Another way to get there:

enum A { B }
enum C<T> { D(T) }

fn main() {
  match B {
    D(a) => format!("{}", a)
  };
}

From my attempts at reproducing this, there seem to be three necessary ingredients:

  • match on value of enum type
  • pattern is a variant of a different, generic enum
  • use generic part of the pattern in a format_args! invocation

The failure is always at line 255 of vtable.rs.

bors added a commit to rust-lang-ci/rust that referenced this issue Dec 1, 2023
…rm-underscore-check, r=flip1995

Remove underscore check for `manual_non_exhaustive` lint

Fixes rust-lang/rust-clippy#10550.

As indicated in rust-lang/rust-clippy#10559, the underscore check should be removed.

changelog: remove underscore check for `manual_non_exhaustive` lint

r? `@blyxyas`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants