Skip to content

thread 'rustc' panicked at 'index out of bounds: the len is 42 but the index is 44', src/libcollections/vec.rs:1166 #32965

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
progval opened this issue Apr 14, 2016 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@progval
Copy link
Contributor

progval commented Apr 14, 2016

error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 42 but the index is 44', src/libcollections/vec.rs:1166
stack backtrace:
   1:     0x7fb3699585a0 - std::sys::backtrace::tracing::imp::write::hf68f1a220b61702c
   2:     0x7fb369965ccb - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hb638acea7c29901b
   3:     0x7fb36996586c - std::panicking::default_hook::h508c3dab3df347d6
   4:     0x7fb36992a85f - std::sys_common::unwind::begin_unwind_inner::h17f9e42de6d55309
   5:     0x7fb36992c948 - std::sys_common::unwind::begin_unwind_fmt::h039d18bd8498e1d0
   6:     0x7fb369955db1 - rust_begin_unwind
   7:     0x7fb3699c576f - core::panicking::panic_fmt::h813eaa27a5810609
   8:     0x7fb3699c5952 - core::panicking::panic_bounds_check::h05a71f19efefb9ed
   9:     0x7fb363fbc31d - _<rustc_data_structures..unify..UnificationTable<K>>::get::hf64695e3671eae18
  10:     0x7fb363f52110 - rustc::infer::InferCtxt::shallow_resolve::he14f87370b70c6f9
  11:     0x7fb3640b2f3c - rustc::traits::fulfill::process_predicate::h04ed8bc957cf2f77
  12:     0x7fb3640b1cb7 - _<rustc_data_structures..obligation_forest..ObligationForest<O, T>>::process_obligations::hd9dc6cdd83920514
  13:     0x7fb3640ad2df - rustc::traits::fulfill::FulfillmentContext::select_where_possible::h17e4d41931457a80
  14:     0x7fb364d1ce51 - rustc_typeck::check::FnCtxt::select_obligations_where_possible::h189cb232d692343d
  15:     0x7fb364d2e5d3 - rustc_typeck::check::FnCtxt::resolve_type_vars_if_possible::h1d7570666bf16eab
  16:     0x7fb364d43126 - rustc_typeck::check::demand::coerce::hde207458b15d8579
  17:     0x7fb364d40836 - rustc_typeck::check::check_argument_types::hc69e88486e09134a
  18:     0x7fb364dc84eb - rustc_typeck::check::callee::confirm_builtin_call::h761f8f11c5201d7e
  19:     0x7fb364d5d10e - rustc_typeck::check::callee::check_call::he759e09782eff4cd
  20:     0x7fb364d446be - rustc_typeck::check::check_expr_with_expectation_and_lvalue_pref::ha6c35ce91e1b159d
  21:     0x7fb364d7b64a - rustc_typeck::check::check_decl_initializer::h58eca7041d689d70
  22:     0x7fb364d7b711 - rustc_typeck::check::check_decl_local::h98ea760dc0bdbe7a
  23:     0x7fb364d7ba01 - rustc_typeck::check::check_stmt::hd7ebe7ec1fc59efe
  24:     0x7fb364d22768 - rustc_typeck::check::check_block_with_expected::hefda918750c2250f
  25:     0x7fb364d438e3 - rustc_typeck::check::check_expr_with_expectation_and_lvalue_pref::ha6c35ce91e1b159d
  26:     0x7fb364d7b966 - rustc_typeck::check::check_stmt::hd7ebe7ec1fc59efe
  27:     0x7fb364d22768 - rustc_typeck::check::check_block_with_expected::hefda918750c2250f
  28:     0x7fb364d1a3f9 - rustc_typeck::check::check_fn::h7f09ec7b7589b105
  29:     0x7fb364d17cac - rustc_typeck::check::check_bare_fn::h808c99e26697d53d
  30:     0x7fb364d12b56 - rustc_typeck::check::check_item_body::hddf2202410fdd9f7
  31:     0x7fb364d0aa51 - rustc_typeck::check::check_item_bodies::hda87b6b514e1eb80
  32:     0x7fb364d01fbf - rustc_typeck::check_crate::h27a801a930dde27a
  33:     0x7fb369eca460 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::he8d0a22aa8076fed
  34:     0x7fb369ec866b - rustc::ty::context::TyCtxt::create_and_enter::h980e1fdb00693075
  35:     0x7fb369ec511e - rustc_driver::driver::phase_3_run_analysis_passes::h611c3bbb7fd33763
  36:     0x7fb369e9797f - rustc_driver::driver::compile_input::hd56cf2fd4d4af18d
  37:     0x7fb369e7dee4 - rustc_driver::run_compiler::h0185bb759e59b39b
  38:     0x7fb369e7b341 - std::sys_common::unwind::try::try_fn::hdf9deeebe718955f
  39:     0x7fb369955d3b - __rust_try
  40:     0x7fb369955ccd - std::sys_common::unwind::inner_try::h74a189ca1fbe8e07
  41:     0x7fb369e7bb8a - _<F as std..boxed..FnBox<A>>::call_box::hb28490749f4628cc
  42:     0x7fb369963e64 - std::sys::thread::Thread::new::thread_start::h40a33956f4cb7596
  43:     0x7fb3624570a3 - start_thread
  44:     0x7fb3695b887c - clone
  45:                0x0 - <unknown>

Rustc version: compiled just now.

It would take me some time to reduce the size of that code to allow you to reproduce the bug, please tell me if this is necessary.
(Note: A previous version of that code caused the typechecker to go to an infinite loop (reading /dev/urandom), but an update of Rustc fixed it)

@progval
Copy link
Contributor Author

progval commented Apr 14, 2016

Actually, I managed to reproduce it with a small code:

pub fn read_object(store: &mut String, references: &mut Vec<String>) {
    ()
}

fn main() {
    let mut store;

    let mut refs = Vec::new();

    read_object(&mut refs, &mut store);
}

@alexcrichton alexcrichton added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 14, 2016
@TimNN
Copy link
Contributor

TimNN commented Apr 15, 2016

On stable an Error is emitted before the ice:

<anon>:10:17: 10:26 error: mismatched types:
 expected `&mut collections::string::String`,
    found `&mut collections::vec::Vec<_>`
(expected struct `collections::string::String`,
    found struct `collections::vec::Vec`) [E0308]
<anon>:10     read_object(&mut refs, &mut store);
                          ^~~~~~~~~
<anon>:10:17: 10:26 help: see the detailed explanation for E0308

@TimNN
Copy link
Contributor

TimNN commented Apr 15, 2016

Looks like a dupe of #31964.

@alexcrichton
Copy link
Member

Indeed!

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

No branches or pull requests

3 participants