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

compiler bug report: 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1' with overloaded calls #13655

Closed
quux00 opened this issue Apr 21, 2014 · 4 comments
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

@quux00
Copy link

quux00 commented Apr 21, 2014

See comment below: #13655 (comment).


old report

I tried running it in the debugger, but couldn't get gdb to find "rust_fail" for a breakpoint. I also didn't check whether this is a duplicate, sorry.

$ rustc -v
rustc 0.11-pre-nightly (e332287 2014-04-16 00:56:30 -0700)
host: x86_64-unknown-linux-gnu

rustc server.rs
schooner/log.rs:202:13: 202:23 error: mismatched types: expected `std::result::Result<~str,std::io::IoError>` but found `std::option::Option<<generic #264>>` (expected enum std::result::Result but found enum std::option::Option)
schooner/log.rs:202             Some(line) => {
                                ^~~~~~~~~~
schooner/log.rs:210:13: 210:17 error: mismatched types: expected `std::result::Result<~str,std::io::IoError>` but found `std::option::Option<<generic #265>>` (expected enum std::result::Result but found enum std::option::Option)
schooner/log.rs:210             None => () // return Err(format!("Problem while reading in log file: {}", path.display().to_str()))
                                ^~~~
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/lib.rs:1
stack backtrace:
   1:     0x2ae4d244bf10 - rt::backtrace::imp::write::hb4d14c641715212670a::v0.11.pre
   2:     0x2ae4d23ad460 - rt::unwind::begin_unwind_inner::hb6257486a54a301cABa::v0.11.pre
   3:     0x2ae4d23ad3d0 - rt::unwind::begin_unwind::h10a9dcad1e815882aBa::v0.11.pre
   4:     0x2ae4d244bb20 - rt::unwind::begin_unwind_raw::h18b61474055627a8Jya::v0.11.pre
   5:     0x2ae4d23ac700 - rt::unwind::fail_::hc606fb5e7f153625nwa::v0.11.pre
   6:     0x2ae4d244bb90 - rt::unwind::fail_bounds_check::closure.40261
   7:     0x2ae4d23ae630 - rt::unwind::fail_bounds_check::hc426cbe6f6d8fda9Kwa::v0.11.pre
   8:     0x2ae4d0082160 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::push_bound_candidates::closure.66419
   9:     0x2ae4d0081060 - middle::typeck::check::autoderef::h3b3cd92df88ba880fO8::v0.11.pre
  10:     0x2ae4d007dda0 - middle::typeck::check::method::LookupContext$LT$$x27a$GT$::push_bound_candidates::hc19431f1eb875546Sy5::v0.11.pre
  11:     0x2ae4d007df30 - middle::typeck::check::method::lookup_in_trait::h66356e4f09bb4e3dGh5::v0.11.pre
  12:     0x2ae4d007e930 - middle::typeck::check::try_overloaded_deref::h6c4b3c92b2204307bS8::v0.11.pre
  13:     0x2ae4d0081060 - middle::typeck::check::autoderef::h3b3cd92df88ba880fO8::v0.11.pre
  14:     0x2ae4d007c360 - middle::typeck::check::method::lookup::h2bab3026e2c612cbKa5::v0.11.pre
  15:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  16:     0x2ae4d00bed70 - middle::typeck::check::check_expr_with_unifier::check_argument_types::hdf195254fb9ad91aqq9::v0.11.pre
  17:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  18:     0x2ae4d001ec70 - middle::typeck::check::_match::check_match::h27f8e9c536cc6bd3dzZ::v0.11.pre
  19:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  20:     0x2ae4d00978e0 - middle::typeck::check::check_block_with_expected::h3838f44d28bed00bJGb::v0.11.pre
  21:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  22:     0x2ae4d001ec70 - middle::typeck::check::_match::check_match::h27f8e9c536cc6bd3dzZ::v0.11.pre
  23:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  24:     0x2ae4d00978e0 - middle::typeck::check::check_block_with_expected::h3838f44d28bed00bJGb::v0.11.pre
  25:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  26:     0x2ae4d001ec70 - middle::typeck::check::_match::check_match::h27f8e9c536cc6bd3dzZ::v0.11.pre
  27:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  28:     0x2ae4d00978e0 - middle::typeck::check::check_block_with_expected::h3838f44d28bed00bJGb::v0.11.pre
  29:     0x2ae4d00c03a0 - middle::typeck::check::check_block_no_value::hd954ad05ca60716aFFb::v0.11.pre
  30:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  31:     0x2ae4d001ec70 - middle::typeck::check::_match::check_match::h27f8e9c536cc6bd3dzZ::v0.11.pre
  32:     0x2ae4d00b4fe0 - middle::typeck::check::check_expr_with_unifier::he8b805180753f0ebom9::v0.11.pre
  33:     0x2ae4d00978e0 - middle::typeck::check::check_block_with_expected::h3838f44d28bed00bJGb::v0.11.pre
  34:     0x2ae4d0093020 - middle::typeck::check::check_fn::h9d9a07999182adc5Zp7::v0.11.pre
  35:     0x2ae4d0092dc0 - middle::typeck::check::check_bare_fn::hb6bc5891dd566922Rf7::v0.11.pre
  36:     0x2ae4d008e130 - middle::typeck::check::check_item::hb61a6cf0c634001eZx7::v0.11.pre
  37:     0x2ae4d008fbb0 - visit::walk_item::h820b10196031a87d1xw::v0.11.pre
  38:     0x2ae4d008fbb0 - visit::walk_item::h820b10196031a87d1xw::v0.11.pre
  39:     0x2ae4d0092ca0 - middle::typeck::check::check_item_types::h81b2805d49e06382rf7::v0.11.pre
  40:     0x2ae4d01d32c0 - util::common::time::h104026deb384af9cxFg::v0.11.pre
  41:     0x2ae4d01d1c90 - middle::typeck::check_crate::hff5b61383c42166fV7t::v0.11.pre
  42:     0x2ae4d06063f0 - driver::driver::phase_3_run_analysis_passes::h268420b55d9aba34Xre::v0.11.pre
  43:     0x2ae4d060ce00 - driver::driver::compile_input::h3ccf917b299cf56eSQe::v0.11.pre
  44:     0x2ae4d06311e0 - run_compiler::he183fbc68c036254gpm::v0.11.pre
  45:     0x2ae4d06488e0 - main_args::closure.91933
  46:     0x2ae4d0647210 - monitor::closure.91818
  47:     0x2ae4d0642af0 - task::TaskBuilder::try::closure.91584
  48:     0x2ae4cf8c5fa0 - task::spawn_opts::closure.7973
  49:     0x2ae4d2446f40 - rt::task::Task::run::closure.40163
  50:     0x2ae4d2452aa0 - rust_try
  51:     0x2ae4d2446d80 - rt::task::Task::run::hf191250bb000025bBr8::v0.11.pre
  52:     0x2ae4cf8c5d70 - task::spawn_opts::closure.7946
  53:     0x2ae4d244aa50 - rt::thread::thread_start::h7631e63c8ba8fa17g68::v0.11.pre
  54:     0x2ae4d2e76ea0 - start_thread
  55:     0x2ae4d2ba1999 - __clone
  56:                0x0 - <unknown>
@alexcrichton
Copy link
Member

Do you have a small piece of code which replicates this issue?

@nathantypanski
Copy link
Contributor

@alexcrichton

#![feature(overloaded_calls)]
extern crate core;
use core::ops::Fn;

struct Bad<T> {
    a: Vec<T>
}   

impl<T> Fn<T, T> for Bad<T> {
    fn call(&self, _: T) -> T {
        self.data.slice_from(0).slice_to(1);
    }   
}

fn main() {
    let mut b = Vec::with_capacity(1);
    let mut v: Bad<uint> = Bad{a: b};
    println!("{}", v(0, 0));
}
$ rustc -v

rustc 0.11.0-pre (ed33080 2014-06-17 20:41:38 +0000)
host: x86_64-unknown-linux-gnu

$ RUST_BACKTRACE=1 rustc die.rs
die.rs:11:9: 11:18 error: attempted access of field `data` on type `&Bad<T>`, but no field with that name was found
die.rs:11         self.data.slice_from(0).slice_to(1);
                  ^~~~~~~~~
die.rs:18:20: 18:27 error: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit
die.rs:18     println!("{}", v(0, 0));
                             ^~~~~~~
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!
die.rs:18:5: 18:29 note: expansion site
error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1', /home/nathan/devel/rust/rust/src/librustc/lib.rs:1

stack backtrace:
   1:     0x7fd888990d90 - rt::backtrace::imp::write::h436707714ecadf3elIp::v0.11.0.pre
   2:     0x7fd8889984c0 - failure::on_fail::hf6cceb4413eaef6dA3p::v0.11.0.pre
   3:     0x7fd88913fe30 - unwind::begin_unwind_inner::h769b42ddf5cb3d4bQRd::v0.11.0.pre
   4:     0x7fd88913f8c0 - unwind::begin_unwind_fmt::h7e40d6e72bc51347jPd::v0.11.0.pre
   5:     0x7fd88913f880 - rust_begin_unwind
   6:     0x7fd889188920 - failure::begin_unwind::h182011a43b7144bf23v::v0.11.0.pre
   7:     0x7fd88918c710 - failure::fail_bounds_check::hfa3dd6729a018c22e2v::v0.11.0.pre
   8:     0x7fd889b239f0 - middle::typeck::check::check_argument_types::h4f89c5a01c41142b2Zd::v0.11.0.pre
   9:     0x7fd889b23470 - middle::typeck::check::check_method_argument_types::hbaff6a741ca4aa435Xd::v0.11.0.pre
  10:     0x7fd889b22690 - middle::typeck::check::try_overloaded_call::h1aef66e95de5d9f6vSd::v0.11.0.pre
  11:     0x7fd889b26080 - middle::typeck::check::check_expr_with_unifier::h859fa852455df2bfDye::v0.11.0.pre
  12:     0x7fd889b26080 - middle::typeck::check::check_expr_with_unifier::h859fa852455df2bfDye::v0.11.0.pre
  13:     0x7fd889b26080 - middle::typeck::check::check_expr_with_unifier::h859fa852455df2bfDye::v0.11.0.pre
  14:     0x7fd889a6bfc0 - middle::typeck::check::_match::check_match::h7d3d137e0628a024lW3::v0.11.0.pre
  15:     0x7fd889b26080 - middle::typeck::check::check_expr_with_unifier::h859fa852455df2bfDye::v0.11.0.pre
  16:     0x7fd889b42d90 - middle::typeck::check::check_stmt::h16245f3a95fccff6YBg::v0.11.0.pre
  17:     0x7fd889afe190 - middle::typeck::check::check_block_with_expected::ha510f76b9f1231639Fg::v0.11.0.pre
  18:     0x7fd889af9b70 - middle::typeck::check::check_fn::h69104696ae3dbd2bdjc::v0.11.0.pre
  19:     0x7fd889af9930 - middle::typeck::check::check_bare_fn::h9009b665b2cddbf2L8b::v0.11.0.pre
  20:     0x7fd889af2580 - middle::typeck::check::check_item::h0a03a1af941c197eZFc::v0.11.0.pre
  21:     0x7fd889af9730 - middle::typeck::check::check_item_types::hd7ce737b3d0be28a37b::v0.11.0.pre
  22:     0x7fd889c787d0 - middle::typeck::check_crate::h45e9c8a03d43b18abJA::v0.11.0.pre
  23:     0x7fd88a1212f0 - driver::driver::phase_3_run_analysis_passes::h9e13cfc7310c64f0Agv::v0.11.0.pre
  24:     0x7fd88a119850 - driver::driver::compile_input::h2b811b1075169df3P4u::v0.11.0.pre
  25:     0x7fd88a1e4440 - driver::run_compiler::h10a82712b6039942rOx::v0.11.0.pre
  26:     0x7fd88a1e4350 - driver::main_args::closure.98482
  27:     0x7fd88a1ffa70 - driver::monitor::closure.99572
  28:     0x7fd88a1fa9a0 - task::TaskBuilder::try::closure.99335
  29:     0x7fd88c138de0 - task::spawn_opts::closure.7192
  30:     0x7fd88913ca00 - task::Task::run::closure.5321
  31:     0x7fd8891a21a0 - rust_try
  32:     0x7fd88913f450 - unwind::try::h45292833fd63fac7fGd::v0.11.0.pre
  33:     0x7fd88913c880 - task::Task::run::ha683dd2de6346afbVVc::v0.11.0.pre
  34:     0x7fd88c138b80 - task::spawn_opts::closure.7165
  35:     0x7fd88913ea10 - thread::thread_start::hac5cc2b4940a2301kdd::v0.11.0.pre
  36:     0x7fd8883fe000 - start_thread
  37:     0x7fd888e07fc9 - __clone
  38:                0x0 - <unknown>

@alexcrichton
Copy link
Member

cc @pcwalton, this has overloaded calls.

@huonw huonw changed the title compiler bug report: 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0' compiler bug report: 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1' Jul 14, 2014
@huonw huonw changed the title compiler bug report: 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1' compiler bug report: 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1' with overloaded calls Jul 14, 2014
@huonw
Copy link
Member

huonw commented Jul 14, 2014

FWIW, the ICE message in the issue does not match the ICE message from the "reproducing" example. I believe the error in the issue body is a dupe of #11844, which is now fixed, but that in the comment still ICEs today.

(I've adjusted the title/description slightly.)

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Nov 7, 2014
@bors bors closed this as completed in 0579d58 Dec 30, 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

No branches or pull requests

4 participants