Skip to content

ICE - 'index out of bounds: the len is 5 but the index is 5', compiler\rustc_middle\src\ty\query\on_disk_cache.rs:458:9 #79835

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
RustyYato opened this issue Dec 8, 2020 · 3 comments
Assignees
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@RustyYato
Copy link
Contributor

RustyYato commented Dec 8, 2020

Code

I don't have a minimal example, because whenever I try to minimize this the ICE goes away. So far, removing any top-level items including, types, modules, or functions will cause the ICE to go away (even if the function is put back). So I believe that this is a caching issue. (further evidenced by compiler\rustc_middle\src\ty\query\on_disk_cache.rs)

This branch contains all the build artifacts, and I can consistently reproduce the ICE if I revert back to this branch.

https://github.com/RustyYato/svec/tree/ICE

edit: currently, you need to build with --features nightly enabled to see the ICE

Meta

rustc --version --verbose:

rustc 1.50.0-nightly (3d6705aa5 2020-12-07)
binary: rustc
commit-hash: 3d6705aa5abffe94c83bf09af8c3ba3c599845fc
commit-date: 2020-12-07
host: x86_64-pc-windows-msvc
release: 1.50.0-nightly

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 5 but the index is 5', compiler\rustc_middle\src\ty\query\on_disk_cache.rs:458:9
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 5 but the index is 5', compiler\rustc_middle\src\ty\query\on_disk_cache.rs:458:9
stack backtrace:
   0:     0x7ffbc020b865 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h106ca6f8fb6a294d
   1:     0x7ffbc023727b - core::fmt::write::h6390b994d95aebdb
   2:     0x7ffbc01fcefd - <std::io::IoSlice as core::fmt::Debug>::fmt::hd713332ae62141f3
   3:     0x7ffbc020fbdd - std::panicking::take_hook::h78f8a454f3a4df82
   4:     0x7ffbc020f66a - std::panicking::take_hook::h78f8a454f3a4df82
   5:     0x7ffba5661127 - rustc_driver::report_ice::h4bc3647b6f621de8
   6:     0x7ffbc0210730 - std::panicking::rust_panic_with_hook::h931fd6f26be82856
   7:     0x7ffbc0210201 - rust_begin_unwind
   8:     0x7ffbc020c20f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h106ca6f8fb6a294d
   9:     0x7ffbc0210159 - rust_begin_unwind
  10:     0x7ffbc02332f0 - core::panicking::panic_fmt::h45da916c710b88f7
  11:     0x7ffbc02332b7 - core::panicking::panic_bounds_check::h9e2c85f20a0ccdcd
  12:     0x7ffba9af02b6 - rustc_middle::ty::query::on_disk_cache::OnDiskCache::compute_cnum_map::hbae92ac2867b06ae
  13:     0x7ffba98fcab9 - rustc_middle::ty::query::force_from_dep_node::h841e1a791cab1f4a
  14:     0x7ffba5845a48 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h0346e58da83a9175
  15:     0x7ffba584583a - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h0346e58da83a9175
  16:     0x7ffba5837a13 - <rustc_interface::proc_macro_decls::Finder as rustc_hir::itemlikevisit::ItemLikeVisitor>::visit_item::h0346e58da83a9175
  17:     0x7ffba58b16b3 - rustc_interface::passes::BoxedResolver::complete::h22e285b7f419ed0b
  18:     0x7ffba585946b - rustc_interface::interface::parse_cfgspecs::he4e421c50de55949
  19:     0x7ffba588ea61 - rustc_interface::passes::QueryContext::print_stats::h34b3c30905286de8
  20:     0x7ffba56c2e4b - <rustc_expand::mbe::macro_parser::MatcherPosHandle as core::ops::deref::DerefMut>::deref_mut::h130ca4adb9e78d16
  21:     0x7ffba56c6066 - <rustc_expand::mbe::macro_parser::MatcherPosHandle as core::ops::deref::DerefMut>::deref_mut::h130ca4adb9e78d16
  22:     0x7ffba56a7513 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hb838ed2d57a61e3c
  23:     0x7ffba56b7826 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h0da38a96661182e5
  24:     0x7ffba5643ccc - <rustc_middle::ty::SymbolName as core::fmt::Display>::fmt::he2ea99b1945e8c7f
  25:     0x7ffba56c7f2b - <rustc_expand::mbe::macro_parser::MatcherPosHandle as core::ops::deref::DerefMut>::deref_mut::h130ca4adb9e78d16
  26:     0x7ffba5608b38 - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  27:     0x7ffba5699aac - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hb838ed2d57a61e3c
  28:     0x7ffba5609bfc - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  29:     0x7ffba56b0f84 - <rustc_driver::args::Error as core::fmt::Debug>::fmt::hb838ed2d57a61e3c
  30:     0x7ffba56b8270 - rustc_ast::util::parser::prec_let_scrutinee_needs_par::h0da38a96661182e5
  31:     0x7ffba5612a3d - <rustc_codegen_ssa::back::linker::MsvcLinker as rustc_codegen_ssa::back::linker::Linker>::no_crt_objects::h47dd01e667a15f55
  32:     0x7ffbc021f4f7 - std::sys::windows::thread::Thread::new::h05d768f6146b61f1
  33:     0x7ffc07127034 - BaseThreadInitThunk
  34:     0x7ffc07e9cec1 - RtlUserThreadStart

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/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.50.0-nightly (3d6705aa5 2020-12-07) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `svec`

To learn more, run the command again with --verbose.

@RustyYato RustyYato added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 8, 2020
@camelid camelid added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example A-incr-comp Area: Incremental compilation and removed A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) labels Dec 8, 2020
@RustyYato
Copy link
Contributor Author

I've minimized the ICE branch on svec that I linked above. Removing anything causes the ICE to disappear, and not come back until I reset back to the ICE branch. Everything is in one file. The features no longer matter, as I stripped away all cfgs.

@RustyYato
Copy link
Contributor Author

RustyYato commented Dec 9, 2020

When I say, anything, I mean

  • types
  • functions
  • attributes
  • use statements
  • associated constants

even if they are unused

@camelid camelid changed the title ICE - Caching issues ICE - 'index out of bounds: the len is 5 but the index is 5', compiler\rustc_middle\src\ty\query\on_disk_cache.rs:458:9 Dec 9, 2020
@cjgillot cjgillot self-assigned this Nov 26, 2021
@istankovic
Copy link
Contributor

This is no longer reproducible with 1.75.0-nightly so I think we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants