Description
Searched a bit, but did not find the same issue. When using const_generics and trying to get an integration test (or benchmark) to run, the compiler ICEs.
I tried this code:
src/lib.rs:
#![feature(const_generics)]
pub struct Foo<const D: usize> {
pub coords: [u8; D],
}
pub fn foo(_: &[Foo<{ 1 }>]) {}
tests/foo.rs:
extern crate rust_ice;
#[test]
fn test_foo() {
rust_ice::foo(&vec![]);
}
Cargo.toml:
[package]
name = "rust_ice"
version = "0.1.0"
edition = "2018"
Commandline:
CARGO_INCREMENTAL=0 cargo test
I expected to see this happen: It should build and the test should run without any problems.
Instead, this happened: The Compiler crashes with the following error:
error: internal compiler error: src/librustc_metadata/decoder.rs:474: entry: id not found: DefIndex(17) in crate rust_ice with number 15
Meta
rustc --version --verbose
:
rustc 1.39.0-nightly (1dd1884 2019-09-22)
binary: rustc
commit-hash: 1dd1884
commit-date: 2019-09-22
host: x86_64-unknown-linux-gnu
release: 1.39.0-nightly
LLVM version: 9.0
Backtrace:
error: internal compiler error: src/librustc_metadata/decoder.rs:474: entry: id not found: DefIndex(17) in crate rust_ice with number 15
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.37/src/backtrace/libunwind.rs:88
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:76
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:60
4: core::fmt::write
at src/libcore/fmt/mod.rs:1030
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1412
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:64
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:196
9: std::panicking::default_hook
at src/libstd/panicking.rs:210
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:477
12: std::panicking::begin_panic
13: rustc_errors::Handler::bug
14: rustc::util::bug::opt_span_bug_fmt::{{closure}}
15: rustc::ty::context::tls::with_opt::{{closure}}
16: rustc::ty::context::tls::with_context_opt
17: rustc::ty::context::tls::with_opt
18: rustc::util::bug::opt_span_bug_fmt
19: rustc::util::bug::bug_fmt
20: rustc_metadata::cstore_impl::provide_extern::type_of
21: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::type_of>::compute
22: rustc::dep_graph::graph::DepGraph::with_task_impl
23: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
24: rustc::ty::instance::Instance::resolve
25: rustc::ty::sty::Const::eval
26: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
27: rustc::ty::fold::TypeFoldable::fold_with
28: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
29: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
30: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
31: <smallvec::SmallVec<A> as core::iter::traits::collect::FromIterator<<A as smallvec::Array>::Item>>::from_iter
32: rustc::ty::fold::TypeFoldable::fold_with
33: rustc::traits::project::normalize
34: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::confirm_builtin_call
35: rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt>::check_call
36: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
37: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
38: rustc_typeck::check::FnCtxt::check_stmt
39: rustc_typeck::check::FnCtxt::check_block_with_expected
40: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_kind
41: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_expr_with_expectation_and_needs
42: rustc_typeck::check::expr::<impl rustc_typeck::check::FnCtxt>::check_return_expr
43: rustc_typeck::check::check_fn
44: rustc::ty::context::GlobalCtxt::enter_local
45: rustc_typeck::check::typeck_tables_of
46: rustc::ty::query::__query_compute::typeck_tables_of
47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
48: rustc::dep_graph::graph::DepGraph::with_task_impl
49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
50: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
51: rustc_typeck::check::typeck_item_bodies
52: rustc::ty::query::__query_compute::typeck_item_bodies
53: rustc::dep_graph::graph::DepGraph::with_task_impl
54: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
55: rustc::util::common::time
56: rustc_typeck::check_crate
57: rustc_interface::passes::analysis
58: rustc::ty::query::__query_compute::analysis
59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
60: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
61: rustc_interface::passes::create_global_ctxt::{{closure}}
62: rustc_interface::interface::run_compiler_in_existing_thread_pool
63: std::thread::local::LocalKey<T>::with
64: scoped_tls::ScopedKey<T>::set
65: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.