Skip to content

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

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

Closed
aran opened this issue Feb 25, 2014 · 1 comment · Fixed by #15235
Closed

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

aran opened this issue Feb 25, 2014 · 1 comment · Fixed by #15235
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@aran
Copy link

aran commented Feb 25, 2014

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
@steveklabnik
Copy link
Member

This seems to be fixed:

$ rustc bugs.rs 
bugs.rs:4:5: 4:12 error: mismatched types: expected `core::result::Result<<generic #9>,<generic integer #0>>` but found `core::option::Option<<generic #12>>` (expected enum core::result::Result but found enum core::option::Option)
bugs.rs:4     Some(k) => match k {
              ^~~~~~~
bugs.rs:7:5: 7:9 error: mismatched types: expected `core::result::Result<<generic #9>,<generic integer #0>>` but found `core::option::Option<<generic #13>>` (expected enum core::result::Result but found enum core::option::Option)
bugs.rs:7     None => ()
              ^~~~
bugs.rs:5:27: 5:28 error: failed to find an implementation of trait core::fmt::Show for <generic #0>
bugs.rs:5       a => println!("{}", a)
                                    ^
note: in expansion of format_args!
<std macros>:2:23: 2:77 note: expansion site
<std macros>:1:1: 3:2 note: in expansion of println!
bugs.rs:5:12: 6:6 note: expansion site

Sawyer47 added a commit to Sawyer47/rust that referenced this issue Jun 28, 2014
@huonw huonw added the I-ICE label Jun 28, 2014
bors added a commit that referenced this issue Jun 28, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants