Skip to content

task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12' #16729

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
tshepang opened this issue Aug 24, 2014 · 3 comments
Closed

Comments

@tshepang
Copy link
Member

I got this code, a simplified form of what I saw in the Guide (section Testing):

fn three_times_four() -> int { 3 * 4 }

#[test]
fn test_1() {
    assert_eq!(12, three_times_four());
}

#[cfg(test)]
mod test {
    use super::three_times_four;

    #[test]
    fn test_2() {
        assert!(12, three_times_four())
    }
}

And running it:

$ rustc --version
rustc 0.12.0-pre (471862f40 2014-08-24 09:30:56 +0000)
$ uname --all
Linux thome 3.15-trunk-amd64 #1 SMP Debian 3.15.1-1~exp1 (2014-06-20) x86_64 GNU/Linux
$ RUST_BACKTRACE=1 rustc --test main.rs
<std macros>:8:12: 14:19 error: mismatched types: expected `bool` but found `<generic integer #0>` (expected bool but found integral variable)
<std macros>:8         if !$cond {
<std macros>:9             fail!($($arg),+)
<std macros>:10         }
<std macros>:11     );
<std macros>:12 )
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 12 but the index is 12', /home/tshepang/projects/rust/src/libsyntax/lib.rs:1

stack backtrace:
   1:     0x7f0cb4473480 - rt::backtrace::imp::write::h235035dd269e20b4UYq
   2:     0x7f0cb4476630 - failure::on_fail::hd1a7e992688ab3ceBkr
   3:     0x7f0cb8a28e40 - unwind::begin_unwind_inner::hb4c6bf8d66435096pie
   4:     0x7f0cb8a28b40 - unwind::begin_unwind_fmt::h86f5356db6ec628ePfe
   5:     0x7f0cb8a28b00 - rust_begin_unwind
   6:     0x7f0cb8a77800 - failure::begin_unwind::h7b5a533fc9421dfbnAk
   7:     0x7f0cb8a7a7c0 - failure::fail_bounds_check::h2e800593d4e78a44zyk
   8:     0x7f0cb758dee0 - codemap::FileMap::get_line::hddd51750c3eea6b5EyE
   9:     0x7f0cb7597f50 - diagnostic::emit::h17d12cac27463098tVF
  10:     0x7f0cb7594e70 - diagnostic::EmitterWriter.Emitter::emit::h072471d33cf09c1a0QF
  11:     0x7f0cb75931f0 - diagnostic::Handler::emit::h5ef2540673a3b36epyF
  12:     0x7f0cb758cae0 - diagnostic::SpanHandler::span_err::haa1d6440e60b94bbEmF
  13:     0x7f0cb9593990 - middle::typeck::infer::InferCtxt<'a>::type_error_message_str_with_expected::hecddb89bcc2602a1Pdc
  14:     0x7f0cb9632e50 - middle::typeck::infer::InferCtxt<'a>::type_error_message::h82a8041df2114fa6glc
  15:     0x7f0cb9633060 - middle::typeck::infer::InferCtxt<'a>::report_mismatched_types::he1a60d697010400emmc
  16:     0x7f0cb95e6580 - middle::typeck::check::demand::suptype::closure.122490
  17:     0x7f0cb95e6490 - middle::typeck::check::demand::suptype_with_fn::h36e7cd05f630094aISO
  18:     0x7f0cb9642be0 - middle::typeck::check::check_expr_has_type::closure.123466
  19:     0x7f0cb9637df0 - middle::typeck::check::check_expr_with_unifier::h532c026a98936bd1cxU
  20:     0x7f0cb9637df0 - middle::typeck::check::check_expr_with_unifier::h532c026a98936bd1cxU
  21:     0x7f0cb9604850 - middle::typeck::check::check_block_with_expected::hcc1fb6e3f987aab0VFW
  22:     0x7f0cb96009d0 - middle::typeck::check::check_fn::haf17c837a63ca21aYOR
  23:     0x7f0cb96006f0 - middle::typeck::check::check_bare_fn::h1697162caded9650DDR
  24:     0x7f0cb95f98d0 - middle::typeck::check::check_item::h3c5ed16ca47f89b7KbS
  25:     0x7f0cb95fb5d0 - visit::walk_item::h13949830449449897568
  26:     0x7f0cb96004f0 - middle::typeck::check::check_item_types::h86b08addca7a3d44UCR
  27:     0x7f0cb907c880 - util::common::time::h7845477028010386476
  28:     0x7f0cb97de3e0 - middle::typeck::check_crate::hca6bcc1827718082koi
  29:     0x7f0cb98a0660 - driver::driver::phase_3_run_analysis_passes::ha18773997d369cedkSw
  30:     0x7f0cb989b800 - driver::driver::compile_input::h83dff1ab89a68b6eqEw
  31:     0x7f0cb992f8d0 - driver::run_compiler::hf037f9b7b9d7b27ejbA
  32:     0x7f0cb992f7e0 - driver::main_args::closure.137206
  33:     0x7f0cb99416b0 - task::TaskBuilder<S>::try_future::closure.138326
  34:     0x7f0cb99414b0 - task::TaskBuilder<S>::spawn_internal::closure.138303
  35:     0x7f0cb8d91640 - task::spawn_opts::closure.8268
  36:     0x7f0cb8a89d20 - rust_try_inner
  37:     0x7f0cb8a89d10 - rust_try
  38:     0x7f0cb8a264b0 - unwind::try::h4632958e716dfba1F6d
  39:     0x7f0cb8a26250 - task::Task::run::h717f2b1ef13686ffZcd
  40:     0x7f0cb8d91400 - task::spawn_opts::closure.8214
  41:     0x7f0cb8a28090 - thread::thread_start::h8bc121b89a283d9aLBd
  42:     0x7f0cb37f2fe0 - start_thread
  43:     0x7f0cb86f6f89 - __clone
  44:                0x0 - <unknown>

Fixing the typo (assert -> assert_eq) builds without an issue.

@tshepang tshepang changed the title task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12', /home/tshepang/projects/rust/src/libsyntax/lib.rs:1 task 'rustc' failed at 'index out of bounds: the len is 12 but the index is 12' Aug 24, 2014
@ghost
Copy link

ghost commented Aug 24, 2014

Thanks! Looks like a duplicate of #14091.

@tshepang
Copy link
Member Author

It's different code though, but I don't know enough to know if that matters.

@alexcrichton
Copy link
Member

Yes, this looks to be a dupe, thanks @jakub-!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants