Skip to content

'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6' #19195

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
dan-t opened this issue Nov 21, 2014 · 3 comments · Fixed by #19158
Closed

'rustc' panicked at 'index out of bounds: the len is 6 but the index is 6' #19195

dan-t opened this issue Nov 21, 2014 · 3 comments · Fixed by #19158
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@dan-t
Copy link

dan-t commented Nov 21, 2014

When trying to build https://github.com/dan-t/rust-confsolve with

rustc 0.13.0-nightly (770378a31 2014-11-20 23:02:01 +0000)
binary: rustc
commit-hash: 770378a313a573776b16237a46b75bafa49072c1
commit-date: 2014-11-20 23:02:01 +0000
host: x86_64-unknown-linux-gnu
release: 0.13.0-nightly

I'm getting

Compiling confsolve v0.0.1 (file:///home/dan/projekte/rust-confsolve)
<std macros>:3:24: 90:27 error: type `std::io::buffered::LineBufferedWriter<std::io::stdio::StdWriter>` cannot be dereferenced
<std macros>:3         let dst = &mut *$dst;
<std macros>:4         format_args!(|args| { dst.write_fmt(args) }, $($arg)*)
<std macros>:5     })
<std macros>:6 )
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. 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' panicked at 'index out of bounds: the len is 6 but the index is 6', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/lib.rs:1

stack backtrace:
   1:     0x2af1b21ea9c0 - rt::backtrace::imp::write::h38e72df4f68c2a0fB9s
   2:     0x2af1b21edb60 - failure::on_fail::hfed62fa5028805c5uwt
   3:     0x2af1b1a83c80 - unwind::begin_unwind_inner::hd2440d158cff1c59nbd
   4:     0x2af1b1a83900 - unwind::begin_unwind_fmt::h1502fd95862e68e1y8c
   5:     0x2af1b1a838c0 - rust_begin_unwind
   6:     0x2af1b1ac9a70 - panicking::panic_fmt::hdb583b5ebe5872a7aOl
   7:     0x2af1b1acee60 - panicking::panic_bounds_check::h4750b1891a0972ceIMl
   8:     0x2af1b3f8ab90 - codemap::FileMap::get_line::hdcd841b8bcad1665m4E
   9:     0x2af1b3fb95b0 - diagnostic::emit::h56f550342f8800f8wvG
  10:     0x2af1b3fb5fd0 - diagnostic::EmitterWriter.Emitter::emit::hbe5adfb70e9cb44alrG
  11:     0x2af1b3fb4850 - diagnostic::Handler::emit::hc019cdbd0851752bF8F
  12:     0x2af1b3f87370 - diagnostic::SpanHandler::span_err::h3a81a48992ff1ca1EWF
  13:     0x2af1b2d7a4f0 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message_str_with_expected::hcaf474f347ea1ddeTKF
  14:     0x2af1b2cc4c30 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message::h4868d740d424dac2dQF
  15:     0x2af1b2cce390 - middle::typeck::check::check_expr_with_unifier::hdebf9fa758ecc032Nzm
  16:     0x2af1b2cce390 - middle::typeck::check::check_expr_with_unifier::hdebf9fa758ecc032Nzm
  17:     0x2af1b2d04c10 - middle::typeck::check::check_decl_local::h2e032403ded7d340gto
  18:     0x2af1b2d04dd0 - middle::typeck::check::check_stmt::heb4bb2683892d7d7gvo
  19:     0x2af1b2c86b00 - middle::typeck::check::check_block_with_expected::h0ba983ab47653a58vzo
  20:     0x2af1b2cce390 - middle::typeck::check::check_expr_with_unifier::hdebf9fa758ecc032Nzm
  21:     0x2af1b2d04c10 - middle::typeck::check::check_decl_local::h2e032403ded7d340gto
  22:     0x2af1b2d04dd0 - middle::typeck::check::check_stmt::heb4bb2683892d7d7gvo
  23:     0x2af1b2c86b00 - middle::typeck::check::check_block_with_expected::h0ba983ab47653a58vzo
  24:     0x2af1b2c5e8f0 - middle::typeck::check::check_fn::hc7a622e19c048aa8e0i
  25:     0x2af1b2c83400 - middle::typeck::check::check_bare_fn::hfb9c28facdaa4f3fjPi
  26:     0x2af1b2c7f1f0 - middle::typeck::check::check_item::h984b1c058d205724t9i
  27:     0x2af1b2c83090 - middle::typeck::check::check_item_types::h1afe01e3a1c1b731tOi
  28:     0x2af1b3026b80 - util::common::time::h4440028039365931314
  29:     0x2af1b3025d90 - middle::typeck::check_crate::hf8e3b89c5e2c098fcwM
  30:     0x2af1b167de50 - driver::driver::phase_3_run_analysis_passes::h5359d51c361e0d69tfS
  31:     0x2af1b1672c70 - driver::driver::compile_input::h56e37c9f95bced56dWR
  32:     0x2af1b16f7560 - driver::run_compiler::hae38ed40c1a5e42bHUT
  33:     0x2af1b16f7450 - driver::run::closure.59803
  34:     0x2af1b1504000 - task::TaskBuilder<S>::try_future::closure.39059
  35:     0x2af1b1503df0 - task::TaskBuilder<S>::spawn_internal::closure.39030
  36:     0x2af1b1274b10 - task::NativeSpawner.Spawner::spawn::closure.2471
  37:     0x2af1b1adc4c0 - rust_try_inner
  38:     0x2af1b1adc4b0 - rust_try
  39:     0x2af1b1a815e0 - unwind::try::h13cddac141b4f78fIZc
  40:     0x2af1b1a81470 - task::Task::run::hafaf90f81703a435y5b
  41:     0x2af1b1274850 - task::NativeSpawner.Spawner::spawn::closure.2397
  42:     0x2af1b1a82c90 - thread::thread_start::hda75e847cb45320fEqc
  43:     0x2af1b72550c0 - start_thread
  44:     0x2af1b1e7e2d9 - __clone
  45:                0x0 - <unknown>
alexcrichton added a commit to alexcrichton/rust that referenced this issue Nov 22, 2014
@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Nov 22, 2014
@dan-t
Copy link
Author

dan-t commented Nov 22, 2014

Is there a temporary workaround?

Thanks!

@japaric
Copy link
Member

japaric commented Nov 22, 2014

@dan-t Most likely change the occurrences of write!(w, /* ... */) (or writeln!) to write!(&mut w, /* .. */). Like this line.

@erickt
Copy link
Contributor

erickt commented Nov 22, 2014

I just tripped over this ICE in serde. I love c-reduce. It came up with the following code that reproduces the bug by reducing 203K down to this in 15 minutes:

#![crate_type = "rlib"]
mod e {
    mod builder {
        struct Serializer;

        impl Serializer {
            fn serialize_int(self, v:int) {
                write!(self, "{}", v)
            }
        }
    }
}

Here's the error:

<std macros>:3:24: 8:28 error: type `e::builder::Serializer` cannot be dereferenced
<std macros>:3         let dst = &mut *$dst;
<std macros>:4         format_args!(|args| { dst.write_fmt(args) }, $($arg)*)
<std macros>:5     })
<std macros>:6 )
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. 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' panicked at 'index out of bounds: the len is 6 but the index is 6', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libsyntax/lib.rs:1

stack backtrace:
   1:        0x112ca15f2 - rt::backtrace::imp::write::he31e36fe59b39292ugt
   2:        0x112ca46ad - failure::on_fail::h7c2689f722982652nCt
   3:        0x112f0f575 - unwind::begin_unwind_inner::h09866e00e97d31fbI2c
   4:        0x112f0f1bf - unwind::begin_unwind_fmt::h443e47d11b48984fTZc
   5:        0x112f0ef62 - rust_begin_unwind
   6:        0x112f59bfc - panicking::panic_fmt::hc979f6c0b0157f68RQl
   7:        0x112f62341 - panicking::panic_bounds_check::hfad71607541b5567pPl
   8:        0x110c711e5 - codemap::FileMap::get_line::h40447e4b57225531m4E
   9:        0x110c9f8d3 - diagnostic::emit::hd3a2cf9de9dee335wvG
  10:        0x110c9c168 - diagnostic::EmitterWriter.Emitter::emit::h8d15319a02e5e7a2lrG
  11:        0x110c9a955 - diagnostic::Handler::emit::h444f90359ca9a887F8F
  12:        0x110c6d37b - diagnostic::SpanHandler::span_err::he607876660b5f38fEWF
  13:        0x11006b990 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message_str_with_expected::h86874d1701a3af0cTKF
  14:        0x10ffbb991 - middle::typeck::infer::InferCtxt<'a, 'tcx>::type_error_message::hbb15e2e5976d3123dQF
  15:        0x10ffcc5a9 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  16:        0x10ffca9a4 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  17:        0x10fff9123 - middle::typeck::check::check_decl_local::h2f92b49b94b8bcc5gto
  18:        0x10fff9313 - middle::typeck::check::check_stmt::h7d4de28493e7bc88gvo
  19:        0x10ff80258 - middle::typeck::check::check_block_with_expected::he7085b8c57c115ecvzo
  20:        0x10ffc67d0 - middle::typeck::check::check_expr_with_unifier::h8837607ae16c10b8Nzm
  21:        0x10ff804cf - middle::typeck::check::check_block_with_expected::he7085b8c57c115ecvzo
  22:        0x10ff59f70 - middle::typeck::check::check_fn::h604cf1058f7c9abce0i
  23:        0x10ff7cb1e - middle::typeck::check::check_bare_fn::h42d50bc38b24ab59jPi
  24:        0x10ff835bf - middle::typeck::check::check_method_body::h3b2984d8707874d1lkj
  25:        0x10ff79bf8 - middle::typeck::check::check_item::ha935ead12b2c5b2ft9i
  26:        0x10ff7c3a2 - visit::walk_mod::h16226120491347839638
  27:        0x10ff7c3ad - visit::walk_mod::h16226120491347839638
  28:        0x10ff7c84b - middle::typeck::check::check_item_types::h466c6c16edcec5c9tOi
  29:        0x110300896 - util::common::time::h12864813766357117792
  30:        0x1102ffd14 - middle::typeck::check_crate::h1acd5e14d073c903cwM
  31:        0x10f8f29a3 - driver::driver::phase_3_run_analysis_passes::h098de55f4a14acee2eS
  32:        0x10f8e6ecc - driver::driver::compile_input::h814765d870318dcf8VR
  33:        0x10f964e65 - driver::run_compiler::h54cbb685f3e65071gUT
  34:        0x10f96363e - driver::run::closure.59668
  35:        0x10f77b5ae - task::TaskBuilder::try_future::closure.38921
  36:        0x112c2f2e4 - task::TaskBuilder::spawn_internal::closure.24355
  37:        0x112f0cddd - task::Task::spawn::closure.5917
  38:        0x112f716ac - rust_try_inner
  39:        0x112f71696 - rust_try
  40:        0x112f0ceb7 - unwind::try::h207282f5be16daac3Qc
  41:        0x112f0cc8c - task::Task::run::h7eee475ba5444e2993b
  42:        0x112f0c98f - task::Task::spawn::closure.5893
  43:        0x112f0e627 - thread::thread_start::hc58864c152053492Wnc
  44:     0x7fff88b882fc - _pthread_body
  45:     0x7fff88b88279 - _pthread_body

bors added a commit that referenced this issue Nov 23, 2014
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

Successfully merging a pull request may close this issue.

4 participants