Skip to content

Index out of bounds @ vtable.rs:25 #12552

Closed
@aran

Description

@aran

This (broken) code triggers a "the compiler hit an unexpected failure path" warning.

fn main() {
  let t = Err(0); 
  match t {
    Some(k) => match k {
      a => println!("{}", a)
    },
    None => ()
  }
}

adonohue-mbp:rust-tutorial adonohue$ rustc bugs.rs 
bugs.rs:4:5: 4:12 error: mismatched types: expected `std::result::Result<<generic #9>,<    generic integer #0>>` but found `std::option::Option<<generic #12>>` (expected enum     std::result::Result but found enum std::option::Option)
bugs.rs:4     Some(k) => match k {
              ^~~~~~~
bugs.rs:7:5: 7:9 error: mismatched types: expected `std::result::Result<<generic #9>,<    generic integer #0>>` but found `std::option::Option<<generic #13>>` (expected enum     std::result::Result but found enum std::option::Option)
bugs.rs:7     None => ()
              ^~~~
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
Ok(task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0',     /Users/adonohue/src/rust/src/librustc/middle/typeck/check/vtable.rs:255
)

Background info:

adonohue-mbp:rust adonohue$ git show --pretty=short
commit c24946e9c68e4543686cf11c392837d4cffea361
Merge: fc1c06d 3950471
Author: bors <[email protected]>

    auto merge of #12493 : eddyb/rust/saner-overloads, r=nikomatsakis

adonohue-mbp:rust adonohue$ uname -a
Darwin adonohue-mbp.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.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