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 with const_generic and integration test #64707

Closed
simon-auch opened this issue Sep 23, 2019 · 1 comment · Fixed by #65365
Closed

ICE with const_generic and integration test #64707

simon-auch opened this issue Sep 23, 2019 · 1 comment · Fixed by #65365
Labels
A-const-generics Area: const generics (parameters and arguments) A-metadata Area: Crate metadata C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@simon-auch
Copy link

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.
@simon-auch simon-auch changed the title ICE with cont_generic and integration test ICE with const_generic and integration test Sep 23, 2019
@jonas-schievink jonas-schievink added A-const-generics Area: const generics (parameters and arguments) A-metadata Area: Crate metadata 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 23, 2019
@Centril Centril added requires-nightly This issue requires a nightly compiler in some way. F-const_generics `#![feature(const_generics)]` labels Sep 23, 2019
@varkor
Copy link
Member

varkor commented Sep 23, 2019

This is probably #61624.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) A-metadata Area: Crate metadata C-bug Category: This is a bug. F-const_generics `#![feature(const_generics)]` I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants