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: range start index 2 out of range for slice of length 0', library/core/src/slice/index.rs:52:5 #101268

Closed
djc opened this issue Sep 1, 2022 · 1 comment
Labels
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

@djc
Copy link
Contributor

djc commented Sep 1, 2022

Code

Not reduced so far. Can reproduce by checking out the code from https://github.com/InstantDomain/instant-xml/tree/ice and running cargo test (running cargo check is not enough). See the last commit for triggering changes.

Meta

rustc --version --verbose:

rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: aarch64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5

Nightly does not panic.

Error output

thread 'rustc' panicked at 'range start index 2 out of range for slice of length 0', library/core/src/slice/index.rs:52:5

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.63.0 (4b91a6ea7 2022-08-08) running on aarch64-apple-darwin

note: compiler flags: -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental

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

query stack during panic:
#0 [typeck] type-checking `<impl at instant-xml/tests/all.rs:141:32: 141:39>::deserialize::<impl at instant-xml/tests/all.rs:141:32: 141:39>::visit_struct`
#1 [typeck_item_bodies] type-checking all item bodies
#2 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `instant-xml`
Backtrace

stack backtrace:
   0:        0x104fc3fe0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h188b7ef1c7993e78
   1:        0x105015a54 - core::fmt::write::he84a3004e7af3f34
   2:        0x104fb70c0 - std::io::Write::write_fmt::h9370b50affaab0be
   3:        0x104fc6c24 - std::panicking::default_hook::{{closure}}::hc074f8023cce83ca
   4:        0x104fc698c - std::panicking::default_hook::hef854b51b9b79ff2
   5:        0x10c434154 - rustc_driver[8d2050f8429f7bc4]::DEFAULT_HOOK::{closure#0}::{closure#0}
   6:        0x104fc71f8 - std::panicking::rust_panic_with_hook::h1e59e224d558a492
   7:        0x104fc7090 - std::panicking::begin_panic_handler::{{closure}}::he1a9d6ab32bfd8c6
   8:        0x104fc44bc - std::sys_common::backtrace::__rust_end_short_backtrace::he9b94791b02f48cd
   9:        0x104fc6de8 - _rust_begin_unwind
  10:        0x105043968 - core::panicking::panic_fmt::h9fec86f6a9c4146e
  11:        0x105017ee4 - core::slice::index::slice_start_index_len_fail_rt::h688e6b228e353181
  12:        0x10500a940 - core::ops::function::FnOnce::call_once::h7f4ad42cb14fdecd
  13:        0x105010ec0 - core::intrinsics::const_eval_select::hfb24506f4368c7d5
  14:        0x105043a18 - core::slice::index::slice_start_index_len_fail::hb490c535f9720713
  15:        0x10fefe174 - <rustc_middle[4fa9dd76776bb2aa]::ty::generics::Generics>::own_substs
  16:        0x10fd711dc - <rustc_infer[b8df2f762d2af832]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[f8f7f977ec6e9d12]::intravisit::Visitor>::visit_expr
  17:        0x10fd70dec - <rustc_infer[b8df2f762d2af832]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[f8f7f977ec6e9d12]::intravisit::Visitor>::visit_expr
  18:        0x10fd70f24 - <rustc_infer[b8df2f762d2af832]::infer::error_reporting::need_type_info::FindInferSourceVisitor as rustc_hir[f8f7f977ec6e9d12]::intravisit::Visitor>::visit_expr
  19:        0x10fd18f08 - <rustc_infer[b8df2f762d2af832]::infer::InferCtxt>::emit_inference_failure_err
  20:        0x10fc11f44 - <rustc_infer[b8df2f762d2af832]::infer::InferCtxt as rustc_trait_selection[3c6344c85e89bbc6]::traits::error_reporting::InferCtxtPrivExt>::maybe_report_ambiguity
  21:        0x10fc03184 - <rustc_infer[b8df2f762d2af832]::infer::InferCtxt as rustc_trait_selection[3c6344c85e89bbc6]::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors
  22:        0x10e8ebdc4 - <rustc_typeck[dc6010940c7a2a65]::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  23:        0x10ea075d4 - <rustc_infer[b8df2f762d2af832]::infer::InferCtxtBuilder>::enter::<&rustc_middle[4fa9dd76776bb2aa]::ty::context::TypeckResults, <rustc_typeck[dc6010940c7a2a65]::check::inherited::InheritedBuilder>::enter<rustc_typeck[dc6010940c7a2a65]::check::typeck_with_fallback<rustc_typeck[dc6010940c7a2a65]::check::typeck::{closure#0}>::{closure#1}, &rustc_middle[4fa9dd76776bb2aa]::ty::context::TypeckResults>::{closure#0}>
  24:        0x10e98b970 - rustc_typeck[dc6010940c7a2a65]::check::typeck
  25:        0x10f42f684 - <rustc_query_system[f18d9eae22d44560]::dep_graph::graph::DepGraph<rustc_middle[4fa9dd76776bb2aa]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[4fa9dd76776bb2aa]::ty::context::TyCtxt, rustc_span[143ffa354e326ede]::def_id::LocalDefId, &rustc_middle[4fa9dd76776bb2aa]::ty::context::TypeckResults>
  26:        0x10f1ee388 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_execute_query::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_query_system[f18d9eae22d44560]::query::caches::DefaultCache<rustc_span[143ffa354e326ede]::def_id::LocalDefId, &rustc_middle[4fa9dd76776bb2aa]::ty::context::TypeckResults>>
  27:        0x10f2c30f8 - rustc_query_system[f18d9eae22d44560]::query::plumbing::get_query::<rustc_query_impl[d9716e6ec5023784]::queries::typeck, rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt>
  28:        0x10ea720fc - <rustc_middle[4fa9dd76776bb2aa]::hir::map::Map>::par_body_owners::<rustc_typeck[dc6010940c7a2a65]::check::typeck_item_bodies::{closure#0}>
  29:        0x10e98f9c0 - rustc_typeck[dc6010940c7a2a65]::check::typeck_item_bodies
  30:        0x10f4578e0 - <rustc_query_system[f18d9eae22d44560]::dep_graph::graph::DepGraph<rustc_middle[4fa9dd76776bb2aa]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[4fa9dd76776bb2aa]::ty::context::TyCtxt, (), ()>
  31:        0x10f22f5e0 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_execute_query::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_query_system[f18d9eae22d44560]::query::caches::DefaultCache<(), ()>>
  32:        0x10f292e08 - rustc_query_system[f18d9eae22d44560]::query::plumbing::get_query::<rustc_query_impl[d9716e6ec5023784]::queries::typeck_item_bodies, rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt>
  33:        0x10ea71964 - <rustc_session[282d64e95cd3bf88]::session::Session>::time::<(), rustc_typeck[dc6010940c7a2a65]::check_crate::{closure#7}>
  34:        0x10e9fa368 - rustc_typeck[dc6010940c7a2a65]::check_crate
  35:        0x10c4bff24 - rustc_interface[db32075e2a9c594e]::passes::analysis
  36:        0x10f44fb48 - <rustc_query_system[f18d9eae22d44560]::dep_graph::graph::DepGraph<rustc_middle[4fa9dd76776bb2aa]::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle[4fa9dd76776bb2aa]::ty::context::TyCtxt, (), core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  37:        0x10f2245d0 - rustc_query_system[f18d9eae22d44560]::query::plumbing::try_execute_query::<rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt, rustc_query_system[f18d9eae22d44560]::query::caches::DefaultCache<(), core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>>
  38:        0x10f2c354c - rustc_query_system[f18d9eae22d44560]::query::plumbing::get_query::<rustc_query_impl[d9716e6ec5023784]::queries::analysis, rustc_query_impl[d9716e6ec5023784]::plumbing::QueryCtxt>
  39:        0x10c3f666c - <rustc_interface[db32075e2a9c594e]::passes::QueryContext>::enter::<rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}::{closure#2}::{closure#3}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  40:        0x10c3d97f0 - <rustc_interface[db32075e2a9c594e]::interface::Compiler>::enter::<rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}::{closure#2}, core[bae5e8ef542d20e5]::result::Result<core[bae5e8ef542d20e5]::option::Option<rustc_interface[db32075e2a9c594e]::queries::Linker>, rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  41:        0x10c3c5bb4 - rustc_span[143ffa354e326ede]::with_source_map::<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_interface[db32075e2a9c594e]::interface::create_compiler_and_run<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#1}>
  42:        0x10c3d9fe8 - <scoped_tls[e8c526b3ddc66487]::ScopedKey<rustc_span[143ffa354e326ede]::SessionGlobals>>::set::<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  43:        0x10c424b68 - std[ad4c17a2ddbcabe2]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[db32075e2a9c594e]::util::run_in_thread_pool_with_globals<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>
  44:        0x10c3f8ef8 - <<std[ad4c17a2ddbcabe2]::thread::Builder>::spawn_unchecked_<rustc_interface[db32075e2a9c594e]::util::run_in_thread_pool_with_globals<rustc_interface[db32075e2a9c594e]::interface::run_compiler<core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>, rustc_driver[8d2050f8429f7bc4]::run_compiler::{closure#1}>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#0}, core[bae5e8ef542d20e5]::result::Result<(), rustc_errors[3321b68084f70bb0]::ErrorGuaranteed>>::{closure#1} as core[bae5e8ef542d20e5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  45:        0x104fcfa5c - std::sys::unix::thread::Thread::new::thread_start::h7b2f9b83fb320a20
  46:        0x1bc56026c - __pthread_deallocate

@djc djc 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 Sep 1, 2022
@TaKO8Ki TaKO8Ki added the E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example label Sep 1, 2022
@steffahn
Copy link
Member

steffahn commented Sep 5, 2022

Regressed in #89862, fixed in 7e2733b (which contains #98610); probably a duplicate of #98598.

@djc djc closed this as completed Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants