Closed
Description
Compiling the following code with rustc 1.40.0-nightly (7979016af 2019-10-20)
with -Z chalk
leads to an ICE. Without chalk, it works fine.
Possible related (because of similar error message) to #62579?
#![feature(const_generics)]
pub struct Foo<T, const N: usize>([T; N]);
impl<T, const N: usize> Foo<T, {N}> {}
fn main() {}
Output:
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> const-bug.rs:1:12
|
1 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
|
= note: `#[warn(incomplete_features)]` on by default
error: internal compiler error: src/librustc/ty/relate.rs:567: var types encountered in super_relate_consts: Const { ty: _, val: Infer(Var(_#0c)) } Const { ty: usize, val: Param(N/#1) }
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:925: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:77
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:61
4: core::fmt::write
at src/libcore/fmt/mod.rs:1028
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:65
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:50
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:189
9: std::panicking::default_hook
at src/libstd/panicking.rs:206
10: rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:473
12: std::panicking::begin_panic
13: rustc_errors::HandlerInner::bug
14: rustc_errors::Handler::bug
15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
16: rustc::ty::context::tls::with_opt::{{closure}}
17: rustc::ty::context::tls::with_context_opt
18: rustc::ty::context::tls::with_opt
19: rustc::util::bug::opt_span_bug_fmt
20: rustc::util::bug::bug_fmt
21: rustc::ty::relate::super_relate_consts
22: <rustc::ty::subst::GenericArg as rustc::ty::relate::Relate>::relate
23: <core::result::Result<T,E> as rustc::ty::context::InternIteratorElement<T,R>>::intern_with
24: rustc::ty::relate::super_relate_tys
25: rustc::infer::combine::<impl rustc::infer::InferCtxt>::super_combine_tys
26: <rustc::infer::nll_relate::TypeRelating<D> as rustc::ty::relate::TypeRelation>::tys
27: <rustc::traits::DomainGoal as rustc::ty::relate::Relate>::relate
28: rustc_traits::chalk_context::unify::unify
29: rustc::infer::InferCtxt::probe
30: rustc_traits::chalk_context::resolvent_ops::<impl chalk_engine::context::ResolventOps<rustc_traits::chalk_context::ChalkArenas,rustc_traits::chalk_context::ChalkArenas> for rustc_traits::chalk_context::ChalkInferenceContext>::resolvent_clause
31: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::push_initial_strands_instantiated
32: rustc::ty::context::GlobalCtxt::enter_local
33: <rustc_traits::chalk_context::ChalkContext as chalk_engine::context::ContextOps<rustc_traits::chalk_context::ChalkArenas>>::instantiate_ucanonical_goal
34: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::get_or_create_table_for_ucanonical_goal
35: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::pursue_strand
36: rustc::ty::context::GlobalCtxt::enter_local
37: <rustc_traits::chalk_context::ChalkContext as chalk_engine::context::ContextOps<rustc_traits::chalk_context::ChalkArenas>>::instantiate_ex_clause
38: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::ensure_answer_recursively
39: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::pursue_strand
40: rustc::ty::context::GlobalCtxt::enter_local
41: <rustc_traits::chalk_context::ChalkContext as chalk_engine::context::ContextOps<rustc_traits::chalk_context::ChalkArenas>>::instantiate_ex_clause
42: chalk_engine::logic::<impl chalk_engine::forest::Forest<C,CO>>::ensure_answer_recursively
43: <chalk_engine::forest::ForestSolver<C,CO> as chalk_engine::context::AnswerStream<C>>::peek_answer
44: <rustc_traits::chalk_context::ChalkContext as chalk_engine::context::AggregateOps<rustc_traits::chalk_context::ChalkArenas>>::make_solution
45: rustc_traits::chalk_context::evaluate_goal
46: rustc::ty::query::__query_compute::evaluate_goal
47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::evaluate_goal>::compute
48: rustc::dep_graph::graph::DepGraph::with_task_impl
49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
50: <rustc::traits::chalk_fulfill::FulfillmentContext as rustc::traits::engine::TraitEngine>::select_where_possible
51: <rustc::traits::chalk_fulfill::FulfillmentContext as rustc::traits::engine::TraitEngine>::select_all_or_error
52: rustc_typeck::check::FnCtxt::select_all_obligations_or_error
53: rustc::ty::context::GlobalCtxt::enter_local
54: rustc_typeck::check::wfcheck::check_item_well_formed
55: rustc::ty::query::__query_compute::check_item_well_formed
56: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_item_well_formed>::compute
57: rustc::dep_graph::graph::DepGraph::with_task_impl
58: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
60: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
61: rustc_data_structures::sync::par_for_each_in
62: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
63: rustc::hir::Crate::par_visit_all_item_likes
64: rustc::util::common::time
65: rustc_typeck::check_crate
66: rustc_interface::passes::analysis
67: rustc::ty::query::__query_compute::analysis
68: rustc::dep_graph::graph::DepGraph::with_task_impl
69: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
70: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
71: rustc_interface::passes::create_global_ctxt::{{closure}}
72: rustc_interface::passes::BoxedGlobalCtxt::enter
73: rustc_interface::interface::run_compiler_in_existing_thread_pool
74: std::thread::local::LocalKey<T>::with
75: scoped_tls::ScopedKey<T>::set
76: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.40.0-nightly (7979016af 2019-10-20) running on x86_64-unknown-linux-gnu
note: compiler flags: -Z chalk
query stack during panic:
#0 [evaluate_goal] evaluating trait selection obligation `T: std::marker::Sized`
#1 [check_item_well_formed] processing `Foo<T, N>`
#2 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error
Code responsible (already has a FIXME):
rust/src/librustc/ty/relate.rs
Lines 560 to 568 in 10f12fe
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(const_generics)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.This issue requires a nightly compiler in some way.