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

ICE in subst.rs (task 'rustc' failed at 'index out of bounds: the len is 1 but the index is 1', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/subst.rs:420 #15905

Closed
pythonesque opened this issue Jul 22, 2014 · 5 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@pythonesque
Copy link
Contributor

Edited with a (reasonably) minimal testcase below. Reproducible with rustc 0.12.0-pre-nightly (f15d6d2 2014-07-20 22:46:29 +0000) on ArchLinux on a Macbook Pro on https://github.com/pythonesque/mud.rs/blob/cee7a78e449a507f3faacf4de16232fed7df5d29/src/main.rs

#![feature(unsafe_destructor)]

fn main() {
    trait Trait<T> {}
    struct Struct<S>(S);

    #[unsafe_destructor]
    impl<S, T: Trait<S>> Drop for Struct<T> {
        fn drop(&mut self) {}
    }
    Struct(());
}

% RUST_BACKTRACE=1 cargo build          
   Compiling mud v0.1.0 (file:/home/$HOME/dev/personal/mud.rs)
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/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/subst.rs:420

stack backtrace:
   1:     0x7fc6f7010d80 - rt::backtrace::imp::write::h86f9dc98984aaec9A7p
   2:     0x7fc6f7014220 - failure::on_fail::h03e0e71824a692d7Psq
   3:     0x7fc6fb06b5d0 - unwind::begin_unwind_inner::h9ad6a00aad1794b670d
   4:     0x7fc6fb06b230 - unwind::begin_unwind_fmt::ha76f7ed4dc0c1e80AYd
   5:     0x7fc6fb06b1f0 - rust_begin_unwind
   6:     0x7fc6fb0aecf0 - failure::begin_unwind::hb5438e30e14a068bKsj
   7:     0x7fc6fb0b25a0 - failure::fail_bounds_check::hc18c7c2fe9e6f28aWqj
   8:     0x7fc6fbc49ad0 - middle::typeck::check::vtable::lookup_vtables::h23a9c732dd2dfb40HZI
   9:     0x7fc6fbb58ae0 - middle::typeck::check::vtable::trans_resolve_method::h924e60b00e7cb248zFK
  10:     0x7fc6fbac4d40 - middle::trans::base::get_res_dtor::h148cab4191686935MYa
  11:     0x7fc6fbac4650 - middle::trans::glue::trans_struct_drop::h6344c728b401d014seY
  12:     0x7fc6fbac45e0 - middle::trans::glue::trans_struct_drop_flag::closure.$x22closure$x22$LP$115800$RP$
  13:     0x7fc6fbac4290 - middle::trans::base::with_cond::hf7e5084ee7d2350c9Rb
  14:     0x7fc6fbabe570 - middle::trans::glue::make_drop_glue::as_closure.$x22as_closure$x22$LP$115766$RP$
  15:     0x7fc6fbabda10 - middle::trans::glue::make_generic_glue::he9f27f4c0d1a742eIHY
  16:     0x7fc6fbab9aa0 - middle::trans::glue::get_drop_glue::h54121c91b866dd1dL4X
  17:     0x7fc6fbab9930 - middle::trans::glue::drop_ty::h21df00a92156d02dr2X
  18:     0x7fc6fbbec520 - middle::trans::cleanup::DropValue.Cleanup::trans::h2dd9d2d61ef253daEJv
  19:     0x7fc6fbaae220 - middle::trans::cleanup::FunctionContext<'a>.CleanupMethods<'a>::pop_and_trans_ast_cleanup_scope::h8ca861c1072d0b147ou
  20:     0x7fc6fbaad280 - middle::trans::controlflow::trans_stmt::h378fa113b41a1fa4jqX
  21:     0x7fc6fbaaee80 - middle::trans::controlflow::trans_block::h10c5d442d00e4096zvX
  22:     0x7fc6fbb62290 - middle::trans::base::trans_closure::h7e6f5cbf01f38b24Fwc
  23:     0x7fc6fbaa2310 - middle::trans::base::trans_fn::hac67266cb4b6c569lJc
  24:     0x7fc6fba9d2d0 - middle::trans::base::trans_item::h1d4f0e354901b9f6H1c
  25:     0x7fc6fbb72200 - middle::trans::base::trans_crate::h59305eb6a53411cbAUd
  26:     0x7fc6fbf934d0 - driver::driver::phase_4_translate_to_llvm::h163f2ef73368e89dbxw
  27:     0x7fc6fbf8a1d0 - driver::driver::compile_input::h2714688c818fc93cD9v
  28:     0x7fc6fc035640 - driver::run_compiler::hdc3f7737fe0af6fbDiz
  29:     0x7fc6fc035550 - driver::main_args::closure.$x22closure$x22$LP$138065$RP$
  30:     0x7fc6fc048bf0 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$139209$RP$
  31:     0x7fc6fc0489b0 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$139186$RP$
  32:     0x7fc6fb3cc210 - task::spawn_opts::closure.$x22closure$x22$LP$8165$RP$
  33:     0x7fc6fb0c2ab0 - rust_try
  34:     0x7fc6fb068680 - unwind::try::h0fa4943ea00a482ewPd
  35:     0x7fc6fb0683e0 - task::Task::run::hf8555f915ed22c94S0c
  36:     0x7fc6fb3cc000 - task::spawn_opts::closure.$x22closure$x22$LP$8111$RP$
  37:     0x7fc6fb06a660 - thread::thread_start::he6fee52c0ee35cbcqnd
  38:     0x7fc6f6378060 - start_thread
  39:     0x7fc6fad33489 - __clone
  40:                0x0 - <unknown>

Could not execute process rustc /home/$HOME/dev/personal/mud.rs/src/main.rs --crate-name mud --crate-type bin --out-dir /home/$HOME/dev/personal/mud.rs/target -L /home/$HOME/dev/personal/mud.rs/target -L /home/$HOME/dev/personal/mud.rs/target/deps (status=101)

@pythonesque
Copy link
Contributor Author

Updated with a minimal testcase.

@seanmonstar
Copy link
Contributor

I've gotten the same error, with different code, and slightly different backtrace.

#![feature(overloaded_calls)]
use std::fmt;
use std::ops::Fn;

pub struct Con<V> {
    data: V
}

pub static Three: Con<&'static [u8]> = Con {
    data: &[3]
};

impl<T: fmt::Show, V: Vector<u8>> Fn<(T,), ConText<T>> for Con<V> {
    #[rust_call_abi_hack]
    fn call(&self, (show,): (T,)) -> ConText<T> {
        ConText {
            data: Vec::from_slice(self.data.as_slice()),
            subject: show
        }
    }
}

pub struct ConText<T> {
    data: Vec<u8>,
    subject: T
}

#[test]
fn test() {
    let f = Three("foo");
}
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 1', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/subst.rs:420

stack backtrace:
   1:     0x7ff0d4304350 - rt::backtrace::imp::write::ha4acd61ef18a62aeDUp
   2:     0x7ff0d4307640 - failure::on_fail::h147f48194e5619a2Afq
   3:     0x7ff0d83a4440 - unwind::begin_unwind_inner::h60a9644c6207f9d1iTd
   4:     0x7ff0d83a40e0 - unwind::begin_unwind_fmt::hbf6376b6994c2990rQd
   5:     0x7ff0d83a40a0 - rust_begin_unwind
   6:     0x7ff0d83e93f0 - failure::begin_unwind::h8aa4b293b7062f1bVWj
   7:     0x7ff0d83ecd70 - failure::fail_bounds_check::h7f693f45d174b9107Uj
   8:     0x7ff0d8e130b0 - middle::trans::common::find_vtable::hd49bb8bbb24cd20e223
   9:     0x7ff0d8db6d20 - middle::trans::meth::trans_method_callee::h13fac7d98a0aa817Hch
  10:     0x7ff0d8de0130 - middle::trans::callee::trans_method_call::closure.$x22closure$x22$LP$112159$RP$
  11:     0x7ff0d8db5090 - middle::trans::callee::trans_call_inner::ha2a49241f2d4197b6zZ
  12:     0x7ff0d8ddfa30 - middle::trans::callee::trans_method_call::h79aeb2e43c302a99mvZ
  13:     0x7ff0d8dee4b0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h45f9ea70500363ffVm1
  14:     0x7ff0d8ded6c0 - middle::trans::expr::trans_unadjusted::h8e92248b02e688feVP0
  15:     0x7ff0d8dacc30 - middle::trans::expr::trans::h9131eec42a5ec2d5tw0
  16:     0x7ff0d8de6090 - middle::trans::callee::trans_args::h0beaffe0f9f6a5a97ZZ
  17:     0x7ff0d8db5090 - middle::trans::callee::trans_call_inner::ha2a49241f2d4197b6zZ
  18:     0x7ff0d8dded60 - middle::trans::callee::trans_call::h8f463c254e0698bdeuZ
  19:     0x7ff0d8dee4b0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h45f9ea70500363ffVm1
  20:     0x7ff0d8dab3e0 - middle::trans::expr::trans_into::h0c47537ec0cfc708ys0
  21:     0x7ff0d8e020f0 - middle::trans::expr::trans_adt::h087e5bbda34e7217wX1
  22:     0x7ff0d8e05cd0 - middle::trans::expr::trans_rec_or_struct::closure.$x22closure$x22$LP$112427$RP$
  23:     0x7ff0d8dee4b0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h45f9ea70500363ffVm1
  24:     0x7ff0d8dab3e0 - middle::trans::expr::trans_into::h0c47537ec0cfc708ys0
  25:     0x7ff0d8dab9e0 - middle::trans::controlflow::trans_block::h5bb191e037b70d18OBW
  26:     0x7ff0d8e5c430 - middle::trans::base::trans_closure::hc88ea69250b3efe49Gb
  27:     0x7ff0d8d9f820 - middle::trans::base::trans_fn::h80584f1466eb039bfTb
  28:     0x7ff0d8d9fe50 - middle::trans::monomorphize::monomorphic_fn::h61dcafaef40b50d8xZV
  29:     0x7ff0d8dd47f0 - middle::trans::callee::trans_fn_ref_with_vtables::h78751fb3aefc06f7R8Y
  30:     0x7ff0d8dd1e50 - middle::trans::callee::trans_fn_ref::h75cc428eb61c9be0wVY
  31:     0x7ff0d8db6d20 - middle::trans::meth::trans_method_callee::h13fac7d98a0aa817Hch
  32:     0x7ff0d8e0b2b0 - middle::trans::expr::trans_overloaded_call::closure.$x22closure$x22$LP$112492$RP$
  33:     0x7ff0d8db5090 - middle::trans::callee::trans_call_inner::ha2a49241f2d4197b6zZ
  34:     0x7ff0d8dee4b0 - middle::trans::expr::trans_rvalue_dps_unadjusted::h45f9ea70500363ffVm1
  35:     0x7ff0d8dab3e0 - middle::trans::expr::trans_into::h0c47537ec0cfc708ys0
  36:     0x7ff0d8e88460 - middle::trans::_match::store_local::closure.$x22closure$x22$LP$115578$RP$
  37:     0x7ff0d8e88100 - middle::trans::_match::mk_binding_alloca::h8111926511742816842
  38:     0x7ff0d8e567e0 - middle::trans::_match::store_local::hc16c4829486bf931D3e
  39:     0x7ff0d8daa930 - middle::trans::base::init_local::he0e6f8d8a560aba7hXa
  40:     0x7ff0d8da9f10 - middle::trans::controlflow::trans_stmt::h8c8ab5f00528c12dywW
  41:     0x7ff0d8dab9e0 - middle::trans::controlflow::trans_block::h5bb191e037b70d18OBW
  42:     0x7ff0d8e5c430 - middle::trans::base::trans_closure::hc88ea69250b3efe49Gb
  43:     0x7ff0d8d9f820 - middle::trans::base::trans_fn::h80584f1466eb039bfTb
  44:     0x7ff0d8d9a7f0 - middle::trans::base::trans_item::h1a8eb49262b769baKac
  45:     0x7ff0d8e6c010 - middle::trans::base::trans_crate::h6d9aacd380ee9d42H3c
  46:     0x7ff0d9299210 - driver::driver::phase_4_translate_to_llvm::h83f7bbcd209edddddiu
  47:     0x7ff0d928f950 - driver::driver::compile_input::h67e0103484fb9c9dTUt
  48:     0x7ff0d933e290 - driver::run_compiler::ha05dba9ca20aca52iZw
  49:     0x7ff0d933e1a0 - driver::main_args::closure.$x22closure$x22$LP$134272$RP$
  50:     0x7ff0d9351060 - task::TaskBuilder<S>::try_future::closure.$x22closure$x22$LP$135416$RP$
  51:     0x7ff0d9350e40 - task::TaskBuilder<S>::spawn_internal::closure.$x22closure$x22$LP$135393$RP$
  52:     0x7ff0d86f8590 - task::spawn_opts::closure.$x22closure$x22$LP$8187$RP$
  53:     0x7ff0d83fcc30 - rust_try
  54:     0x7ff0d83a1750 - unwind::try::h2d0dc9479d15367bnHd
  55:     0x7ff0d83a14b0 - task::Task::run::h854afb19e4abdac4dSc
  56:     0x7ff0d86f8380 - task::spawn_opts::closure.$x22closure$x22$LP$8133$RP$
  57:     0x7ff0d83a3510 - thread::thread_start::h2a1fd0502c67d799hfd
  58:     0x7ff0d36880c0 - start_thread
  59:     0x7ff0d80732d9 - __clone
  60:                0x0 - <unknown>

Seeing the last step in trace before unwind is 8, I turned on RUST_LOG=rustc::middle::trans::common=debug, and this is the last line before the failure.

DEBUG:rustc::middle::trans::common: find_vtable(n_param=middle::typeck::param_index{space: TypeSpace, index: 1u}, n_bound=0, ps=param_substs(Substs[types=[[&'static str, &'static [u8]];[];[]], regions=[[];[];[]]]))

@pythonesque
Copy link
Contributor Author

I actually suspect that is a different error, since your code, error message (they are both "index out of bound" errors, but yours has length 0, not length 1), and stack trace are all different.

@seanmonstar
Copy link
Contributor

True, they differ slightly, and if it completely unrelated I can open a second bug. But it seemed the cause is that vtables are somehow losing or not keeping some entries, and that may be causing both.

sfackler added a commit to sfackler/r2d2 that referenced this issue Aug 5, 2014
This doesn't acually work since generic destructors are still broken :(
rust-lang/rust#15905
@ghost
Copy link

ghost commented Sep 30, 2014

Dupe of #14695.

bors added a commit to rust-lang-ci/rust that referenced this issue Nov 16, 2023
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