Closed
Description
Yet another ICE on const generics. (I'm pretty sure it's duplicate, but I have not found issue with exact same error.)
I tried this code:
#![feature(const_generics)]
struct Foo<T, const N: usize>([T; {N}]);
impl<T, const N: usize> Foo<T, {N}> {
fn foo(&self) -> usize {
{N}
}
}
fn main() {
let foo = Foo([0u32; 21]);
}
I expected either successfull compilation or "not-ICE" error.
Instead my device exploded violently I got an ICE.
Meta
$ rustc --version --verbose
rustc 1.36.0-nightly (7158ed9cb 2019-05-15)
binary: rustc
commit-hash: 7158ed9cbea805adf8161d3deaadba2f85b7692e
commit-date: 2019-05-15
host: x86_64-unknown-linux-gnu
release: 1.36.0-nightly
LLVM version: 8.0
Backtrace:
Compiling rust-playground1 v0.1.0 (/home/me/Development/rust-playground)
warning: the feature `const_generics` is incomplete and may cause the compiler to crash
--> src/main.rs:1:12
|
1 | #![feature(const_generics)]
| ^^^^^^^^^^^^^^
error: internal compiler error: src/librustc/infer/canonical/canonicalizer.rs:553: failed to lift `QueryResponse { var_values: CanonicalVarValues { var_values: [Const { ty: _, val: Infer(Canonical(DebruijnIndex(0), 0)) }] }, region_constraints: [], certainty: Proven, value: DropckOutlivesResult { kinds: [], overflows: [] } }`, canonicalized from `QueryResponse { var_values: CanonicalVarValues { var_values: [Const { ty: _, val: Infer(Var(_#0c)) }] }, region_constraints: [], certainty: Proven, value: DropckOutlivesResult { kinds: [], overflows: [] } }`
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:637:9
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:71
2: std::panicking::default_hook::{{closure}}
at src/libstd/sys_common/backtrace.rs:59
at src/libstd/panicking.rs:197
3: std::panicking::default_hook
at src/libstd/panicking.rs:211
4: rustc::util::common::panic_hook
5: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:478
6: std::panicking::begin_panic
7: rustc_errors::Handler::bug
8: rustc::util::bug::opt_span_bug_fmt::{{closure}}
9: rustc::ty::context::tls::with_opt::{{closure}}
10: rustc::ty::context::tls::with_context_opt
11: rustc::ty::context::tls::with_opt
12: rustc::util::bug::opt_span_bug_fmt
13: rustc::util::bug::bug_fmt
14: rustc::infer::canonical::canonicalizer::Canonicalizer::canonicalize
15: rustc::infer::canonical::query_response::<impl rustc::infer::InferCtxt>::make_canonicalized_query_response
16: rustc::ty::context::tls::with_context::{{closure}}
17: rustc::ty::context::GlobalCtxt::enter_local
18: rustc_traits::dropck_outlives::dropck_outlives
19: rustc::ty::query::__query_compute::dropck_outlives
20: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::dropck_outlives>::compute
21: rustc::dep_graph::graph::DepGraph::with_task_impl
22: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
23: rustc::traits::query::dropck_outlives::<impl rustc::infer::at::At>::dropck_outlives
24: rustc_typeck::check::dropck::check_safety_of_destructor_if_necessary
25: rustc::hir::Pat::walk_
26: <rustc_typeck::check::regionck::RegionCtxt as rustc::hir::intravisit::Visitor>::visit_local
27: rustc::hir::intravisit::walk_expr
28: <rustc_typeck::check::regionck::RegionCtxt as rustc::hir::intravisit::Visitor>::visit_expr
29: rustc_typeck::check::regionck::RegionCtxt::visit_fn_body
30: rustc_typeck::check::regionck::<impl rustc_typeck::check::FnCtxt>::regionck_fn
31: rustc::ty::context::GlobalCtxt::enter_local
32: rustc_typeck::check::typeck_tables_of
33: rustc::ty::query::__query_compute::typeck_tables_of
34: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_tables_of>::compute
35: rustc::dep_graph::graph::DepGraph::with_task_impl
36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
37: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
38: rustc_typeck::check::typeck_item_bodies
39: rustc::ty::query::__query_compute::typeck_item_bodies
40: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::typeck_item_bodies>::compute
41: rustc::dep_graph::graph::DepGraph::with_task_impl
42: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
43: rustc::util::common::time
44: rustc_typeck::check_crate
45: rustc_interface::passes::analysis
46: rustc::ty::query::__query_compute::analysis
47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::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::context::tls::enter_global
51: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
52: rustc_interface::passes::create_global_ctxt::{{closure}}
53: rustc_interface::interface::run_compiler_in_existing_thread_pool
54: std::thread::local::LocalKey<T>::with
55: scoped_tls::ScopedKey<T>::set
56: syntax::with_globals
query stack during panic:
#0 [dropck_outlives] computing dropck types for `Canonical { max_universe: U0, variables: [CanonicalVarInfo { kind: Const(U0) }], value: ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: UserFacing, def_id: None }, value: Foo<u32, _> } }`
#1 [typeck_tables_of] processing `main`
#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.36.0-nightly (7158ed9cb 2019-05-15) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `rust-playground1`.
To learn more, run the command again with --verbose.