Skip to content

Serde const generics experiment ICE #61806

Closed
@est31

Description

@est31

Link to code: https://github.com/est31/serde/tree/const_generics_ice

Commands to reproduce:

git clone https://github.com/est31/serde serde-ice
cd serde-ice
git checkout const_generics_ice
cargo +nightly build

Gives the ICE error message:

error: internal compiler error: src/librustc_metadata/decoder.rs:485: entry: id not found: DefIndex(1453) in crate serde with number 16

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:643:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:198
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:212
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:479
   8: std::panicking::begin_panic
   9: rustc_errors::Handler::bug
  10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  11: rustc::ty::context::tls::with_opt::{{closure}}
  12: rustc::ty::context::tls::with_context_opt
  13: rustc::ty::context::tls::with_opt
  14: rustc::util::bug::opt_span_bug_fmt
  15: rustc::util::bug::bug_fmt
  16: rustc_metadata::decoder::<impl rustc_metadata::cstore::CrateMetadata>::entry
  17: rustc_metadata::decoder::<impl rustc_metadata::cstore::CrateMetadata>::get_type
  18: rustc_metadata::cstore_impl::provide_extern::type_of
  19: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
  20: rustc::dep_graph::graph::DepGraph::with_task_impl
  21: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  22: rustc::ty::instance::Instance::resolve
  23: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_const
  24: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
  25: rustc::ty::fold::TypeFoldable::fold_with
  26: rustc::ty::fold::TypeFoldable::fold_with
  27: rustc::traits::project::normalize_with_depth
  28: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
  29: <core::iter::adapters::flatten::FlatMap<I,U,F> as core::iter::traits::iterator::Iterator>::next
  30: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  31: rustc::traits::select::SelectionContext::impl_or_trait_obligations
  32: rustc::traits::select::SelectionContext::vtable_impl
  33: rustc::infer::InferCtxt::in_snapshot
  34: rustc::traits::select::SelectionContext::confirm_candidate
  35: rustc::traits::select::SelectionContext::select
  36: rustc_data_structures::obligation_forest::ObligationForest<O>::process_obligations
  37: <rustc::traits::fulfill::FulfillmentContext as rustc::traits::engine::TraitEngine>::select_where_possible
  38: rustc_typeck::check::FnCtxt::select_obligations_where_possible
  39: rustc_typeck::check::FnCtxt::check_argument_types
  40: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
  41: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
  42: rustc_typeck::check::FnCtxt::check_expr_kind
  43: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  44: rustc_typeck::check::FnCtxt::check_stmt
  45: rustc_typeck::check::FnCtxt::check_block_with_expected
  46: rustc_typeck::check::FnCtxt::check_expr_kind
  47: rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs
  48: rustc_typeck::check::FnCtxt::check_return_expr
  49: rustc_typeck::check::check_fn
  50: rustc::ty::context::GlobalCtxt::enter_local
  51: rustc_typeck::check::typeck_tables_of
  52: rustc::ty::query::__query_compute::typeck_tables_of
  53: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
  54: rustc::dep_graph::graph::DepGraph::with_task_impl
  55: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  56: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  57: rustc_typeck::check::typeck_item_bodies
  58: rustc::ty::query::__query_compute::typeck_item_bodies
  59: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_item_bodies>::compute
  60: rustc::dep_graph::graph::DepGraph::with_task_impl
  61: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  62: rustc::util::common::time
  63: rustc_typeck::check_crate
  64: rustc_interface::passes::analysis
  65: rustc::ty::query::__query_compute::analysis
  66: rustc::dep_graph::graph::DepGraph::with_task_impl
  67: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  68: rustc::ty::context::tls::enter_global
  69: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  70: rustc_interface::passes::create_global_ctxt::{{closure}}
  71: rustc_interface::interface::run_compiler_in_existing_thread_pool
  72: std::thread::local::LocalKey<T>::with
  73: scoped_tls::ScopedKey<T>::set
  74: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [type_of] processing `_IMPL_SERIALIZE_FOR_UnitStruct::_serde::ser::impls::<impl _IMPL_SERIALIZE_FOR_UnitStruct::_serde::Serialize for [T; _]>::{{constant}}#0`
#1 [typeck_tables_of] processing `test_array`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error


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: rustc 1.37.0-nightly (2887008e0 2019-06-12) running on x86_64-unknown-linux-gnu

cc @varkor @dtolnay

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-genericsArea: const generics (parameters and arguments)C-bugCategory: This is a bug.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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions