Skip to content

ICE: index out of bounds: the len is 0 but the index is 18446744073709551615 #83993

Closed
@DutchGhost

Description

@DutchGhost

Code

#![feature(const_generics)]
fn bug<'a>()
where
    for<'b> [(); {
        let x: &'b ();
        0
    }]:
{}

Meta

rustc --version --verbose:

Stable 1.51.0
Beta 1.52.0-beta.3
Nightly (2021-04-06 215738137bcbef2c3637)

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615', /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/compiler/rustc_infer/src/infer/nll_relate/mod.rs:214:22
Backtrace

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 18446744073709551615', /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/compiler/rustc_infer/src/infer/nll_relate/mod.rs:214:22
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/panicking.rs:69:5
   3: <rustc_infer::infer::nll_relate::TypeRelating<D> as rustc_middle::ty::relate::TypeRelation>::regions
   4: rustc_middle::ty::relate::super_relate_tys
   5: rustc_infer::infer::combine::<impl rustc_infer::infer::InferCtxt>::super_combine_tys
   6: rustc_middle::ty::relate::TypeRelation::relate
   7: rustc_mir::borrow_check::type_check::type_check
   8: rustc_mir::borrow_check::nll::compute_regions
   9: rustc_mir::borrow_check::do_mir_borrowck
  10: rustc_infer::infer::InferCtxtBuilder::enter
  11: rustc_mir::borrow_check::mir_borrowck
  12: core::ops::function::FnOnce::call_once
  13: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_borrowck>::compute
  14: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  15: rustc_data_structures::stack::ensure_sufficient_stack
  16: rustc_query_system::query::plumbing::force_query_with_job
  17: rustc_query_system::query::plumbing::get_query_impl
  18: rustc_query_system::query::plumbing::ensure_query_impl
  19: rustc_mir::transform::mir_drops_elaborated_and_const_checked
  20: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_drops_elaborated_and_const_checked>::compute
  21: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  22: rustc_data_structures::stack::ensure_sufficient_stack
  23: rustc_query_system::query::plumbing::force_query_with_job
  24: rustc_query_system::query::plumbing::get_query_impl
  25: rustc_mir::transform::inner_mir_for_ctfe
  26: rustc_mir::transform::mir_for_ctfe
  27: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::mir_for_ctfe>::compute
  28: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  29: rustc_data_structures::stack::ensure_sufficient_stack
  30: rustc_query_system::query::plumbing::force_query_with_job
  31: rustc_query_system::query::plumbing::get_query_impl
  32: <rustc_mir::const_eval::machine::CompileTimeInterpreter as rustc_mir::interpret::machine::Machine>::load_mir
  33: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  34: rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider
  35: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_allocation_raw>::compute
  36: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  37: rustc_data_structures::stack::ensure_sufficient_stack
  38: rustc_query_system::query::plumbing::force_query_with_job
  39: rustc_query_system::query::plumbing::get_query_impl
  40: rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider
  41: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::eval_to_const_value_raw>::compute
  42: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  43: rustc_data_structures::stack::ensure_sufficient_stack
  44: rustc_query_system::query::plumbing::force_query_with_job
  45: rustc_query_system::query::plumbing::get_query_impl
  46: rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve
  47: rustc_infer::infer::InferCtxt::const_eval_resolve
  48: rustc_trait_selection::traits::const_evaluatable::is_const_evaluatable
  49: rustc_trait_selection::traits::fulfill::FulfillProcessor::progress_changed_obligations
  50: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  51: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_all_or_error
  52: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::select_all_obligations_or_error
  53: rustc_infer::infer::InferCtxtBuilder::enter
  54: rustc_typeck::check::wfcheck::check_item_well_formed
  55: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_item_well_formed>::compute
  56: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  57: rustc_data_structures::stack::ensure_sufficient_stack
  58: rustc_query_system::query::plumbing::force_query_with_job
  59: rustc_query_system::query::plumbing::get_query_impl
  60: rustc_query_system::query::plumbing::ensure_query_impl
  61: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::itemlikevisit::ParItemLikeVisitor>::visit_item
  62: rustc_data_structures::sync::par_for_each_in
  63: rustc_hir::hir::Crate::par_visit_all_item_likes
  64: rustc_session::session::Session::track_errors
  65: rustc_typeck::check_crate
  66: rustc_interface::passes::analysis
  67: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
  68: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  69: rustc_data_structures::stack::ensure_sufficient_stack
  70: rustc_query_system::query::plumbing::force_query_with_job
  71: rustc_query_system::query::plumbing::get_query_impl
  72: rustc_interface::passes::QueryContext::enter
  73: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  74: rustc_span::with_source_map
  75: rustc_interface::interface::create_compiler_and_run
  76: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

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.51.0 (2fd73fabe 2021-03-23) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type lib

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

query stack during panic:
#0 [mir_borrowck] borrow-checking `bug::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `bug::{constant#0}`
#2 [mir_for_ctfe] caching mir of `bug::{constant#0}` for CTFE
#3 [eval_to_allocation_raw] const-evaluating + checking `bug::{constant#0}`
#4 [eval_to_const_value_raw] simplifying constant for the type system `bug::{constant#0}`
#5 [check_item_well_formed] checking that `bug` is well-formed
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error; 1 warning emitted

For more information about this error, try `rustc --explain E0554`.
error: could not compile `playground`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.F-const_generics`#![feature(const_generics)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions