Description
Got an ICE while trying to make a crate that implements Julia-like broadcast functionality. Not the most minimal example:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=64799ae35f987dc509e11973c1f20153
backtrace
thread 'rustc' panicked at 'Unknown variable: 0', compiler/rustc_ty_utils/src/instance.rs:46:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.55.0-nightly (955b9c0d4 2021-07-12) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
thread 'rustc' panicked at 'substs of instance DefId(0:4 ~ playground[d8fc]::TensorDimension::DIM) not normalized for codegen: [^1]', compiler/rustc_middle/src/ty/instance.rs:286:9
stack backtrace:
0: 0x7fef2af43f20 - std::backtrace_rs::backtrace::libunwind::trace::h706b838f5bbd876b
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
1: 0x7fef2af43f20 - std::backtrace_rs::backtrace::trace_unsynchronized::hc15f29ae7822b7b8
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fef2af43f20 - std::sys_common::backtrace::_print_fmt::h7c580c971f91926c
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7fef2af43f20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h2a772198c4032452
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7fef2afb1d0c - core::fmt::write::h9a6d9c74526a6c1b
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/core/src/fmt/mod.rs:1115:17
5: 0x7fef2af35665 - std::io::Write::write_fmt::h00f38d9eb2c32e02
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/io/mod.rs:1663:15
6: 0x7fef2af47c3b - std::sys_common::backtrace::_print::h5b3c171e6f864ae4
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7fef2af47c3b - std::sys_common::backtrace::print::h93b9e9ed2a98e611
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7fef2af47c3b - std::panicking::default_hook::{{closure}}::hd8da92bb68d520c5
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:208:50
9: 0x7fef2af47711 - std::panicking::default_hook::hdbc8b2951c5afbab
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:225:9
10: 0x7fef2b71df01 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h9115897f26ef0e94
11: 0x7fef2af48469 - std::panicking::rust_panic_with_hook::h8a4c841655926f4e
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:626:17
12: 0x7fef2af47f27 - std::panicking::begin_panic_handler::{{closure}}::h471b6bc74904b7b0
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:519:13
13: 0x7fef2af4441c - std::sys_common::backtrace::__rust_end_short_backtrace::h309f5c707f29932f
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:141:18
14: 0x7fef2af47e89 - rust_begin_unwind
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:515:5
15: 0x7fef2af10dbb - std::panicking::begin_panic_fmt::h124dfb9fde553188
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:457:5
16: 0x7fef2d16de8e - rustc_middle::ty::instance::Instance::new::h4bc0b902805b73c3
17: 0x7fef2bca7d95 - std::thread::local::LocalKey<T>::with::h1bf9bba74543d0f2
18: 0x7fef2bcb7da4 - std::thread::local::LocalKey<T>::with::hbb41c71ef11f8b4d
19: 0x7fef2bd09dbe - rustc_query_impl::make_query::resolve_instance::h1b43a4ec840764d1
20: 0x7fef2bc487a0 - rustc_query_system::query::plumbing::QueryState<D,K>::try_collect_active_jobs::h82516257c956e5dd
21: 0x7fef2bcf2c64 - rustc_query_impl::Queries::try_collect_active_jobs::hfa1414681bc4a6f4
22: 0x7fef2bcc02c1 - rustc_query_system::query::job::print_query_stack::h5730919cbd425e7c
23: 0x7fef2b82be97 - rustc_interface::interface::try_print_query_stack::h440ea915a08bc272
24: 0x7fef2b71e2ef - rustc_driver::report_ice::hc86e0f709da84157
25: 0x7fef2af48469 - std::panicking::rust_panic_with_hook::h8a4c841655926f4e
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:626:17
26: 0x7fef2af47f27 - std::panicking::begin_panic_handler::{{closure}}::h471b6bc74904b7b0
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:519:13
27: 0x7fef2af4441c - std::sys_common::backtrace::__rust_end_short_backtrace::h309f5c707f29932f
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys_common/backtrace.rs:141:18
28: 0x7fef2af47e89 - rust_begin_unwind
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:515:5
29: 0x7fef2af10dbb - std::panicking::begin_panic_fmt::h124dfb9fde553188
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/panicking.rs:457:5
30: 0x7fef2ca15e09 - rustc_ty_utils::instance::inner_resolve_instance::ha62fdd9539be506f
31: 0x7fef2ca12b16 - rustc_ty_utils::instance::resolve_instance::h6c43c832ecc9f58d
32: 0x7fef2cb02be6 - rustc_query_system::query::plumbing::get_query_impl::h98c7a37900e75c1a
33: 0x7fef2cb541d5 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance::h131142b59edae365
34: 0x7fef2d16ed34 - rustc_middle::ty::instance::Instance::resolve_opt_const_arg::h85eff761c92245d7
35: 0x7fef2d12044a - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::h05f9be04dd287144
36: 0x7fef2d043ab7 - <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_const::h2b8fc62883ffe49e
37: 0x7fef2d9ea421 - <rustc_trait_selection::traits::query::normalize::QueryNormalizer as rustc_middle::ty::fold::TypeFolder>::fold_mir_const::hae5a0c34494777c7
38: 0x7fef2d3ac027 - <rustc_infer::infer::at::At as rustc_trait_selection::traits::query::normalize::AtExt>::normalize::hd29ab4f556b4eba1
39: 0x7fef2d39e861 - rustc_infer::infer::InferCtxtBuilder::enter::h914fd9bf94352a47
40: 0x7fef2d3ad482 - core::ops::function::FnOnce::call_once::h07f7ef4c390d1173
41: 0x7fef2d569156 - rustc_query_system::query::plumbing::get_query_impl::h228c7f5596c35d25
42: 0x7fef2d635452 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::normalize_mir_const_after_erasing_regions::h8a95c105f8c26374
43: 0x7fef2cda9f42 - rustc_middle::ty::normalize_erasing_regions::<impl rustc_middle::ty::context::TyCtxt>::normalize_erasing_regions::h18e25ec2a174f17d
44: 0x7fef2cd8608f - rustc_mir::interpret::eval_context::InterpCx<M>::push_stack_frame::h57241db08af59ac2
45: 0x7fef2cc9a6dc - rustc_mir::const_eval::eval_queries::eval_to_allocation_raw_provider::heae3d1b1c6a8baf5
46: 0x7fef2cb10bca - rustc_query_system::query::plumbing::get_query_impl::he3c6640669a2a2c2
47: 0x7fef2cb51d6c - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_allocation_raw::hdc0a37858c2b9f88
48: 0x7fef2cc98f74 - rustc_mir::const_eval::eval_queries::eval_to_const_value_raw_provider::he812b93c2ed73711
49: 0x7fef2cade79a - rustc_query_system::query::plumbing::get_query_impl::h1181b9a9d9860866
50: 0x7fef2cb51e90 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::eval_to_const_value_raw::h22567b86e0543a37
51: 0x7fef2d10dafa - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_global_id::h53e1a0ab4f3788ab
52: 0x7fef2d12048d - rustc_middle::mir::interpret::queries::<impl rustc_middle::ty::context::TyCtxt>::const_eval_resolve::h05f9be04dd287144
53: 0x7fef2da1e726 - rustc_infer::infer::InferCtxt::const_eval_resolve::h1fc86c723833ff6a
54: 0x7fef2c471060 - rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively::{{closure}}::{{closure}}::h1aeb03e1892925ca
55: 0x7fef2d0401df - rustc_data_structures::stack::ensure_sufficient_stack::ha262825375eb89a5
56: 0x7fef2d074ddf - rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively::hd50b7c067b113b6a
57: 0x7fef2d066bdf - rustc_trait_selection::traits::select::SelectionContext::evaluate_predicates_recursively::h03c6cc0fc2fb0c94
58: 0x7fef2d022860 - rustc_infer::infer::InferCtxt::probe::hfac507797fb7b5fb
59: 0x7fef2d074fd1 - rustc_trait_selection::traits::select::SelectionContext::evaluate_candidate::hc0585d9092b0698c
60: 0x7fef2d0822b6 - <core::iter::adapters::ResultShunt<I,E> as core::iter::traits::iterator::Iterator>::next::hea7024379e5fe349
61: 0x7fef2d03c916 - <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter::hd9d203e90c144a08
62: 0x7fef2d062c3b - rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation_no_cache::h043296d3b8836763
63: 0x7fef2d05eb3b - rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task::h47195f4d0fb22b03
64: 0x7fef2d06ba50 - rustc_trait_selection::traits::select::candidate_assembly::<impl rustc_trait_selection::traits::select::SelectionContext>::candidate_from_obligation::h0d6cdd36b0a570fb
65: 0x7fef2d068207 - rustc_trait_selection::traits::select::SelectionContext::evaluate_stack::h69a1f50b2792c57d
66: 0x7fef2d05efde - rustc_query_system::dep_graph::graph::DepGraph<K>::with_anon_task::h5fa14234b94c48c7
67: 0x7fef2d067524 - rustc_trait_selection::traits::select::SelectionContext::evaluate_trait_predicate_recursively::h4fdebf34a57f66fd
68: 0x7fef2d03f8a9 - rustc_data_structures::stack::ensure_sufficient_stack::ha262825375eb89a5
69: 0x7fef2d074ddf - rustc_trait_selection::traits::select::SelectionContext::evaluate_predicate_recursively::hd50b7c067b113b6a
70: 0x7fef2d021d2d - rustc_infer::infer::InferCtxt::probe::h49937ac5b33c5781
71: 0x7fef2d066b10 - rustc_trait_selection::traits::select::SelectionContext::evaluate_root_obligation::h2f9d0895cdb84bd0
72: 0x7fef2c8886d3 - rustc_infer::infer::InferCtxtBuilder::enter_with_canonical::h9cdf89db81539f0d
73: 0x7fef2c89048b - rustc_traits::evaluate_obligation::evaluate_obligation::h4ab552bc983eaa00
74: 0x7fef2caeeed9 - rustc_query_system::query::plumbing::get_query_impl::h4920e614a64e9368
75: 0x7fef2cb53f23 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation::ha27bbdceb77d17b4
76: 0x7fef2d02737c - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation::hf5cdf6c2f7bbe8fe
77: 0x7fef2d027690 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow::hb467e41644548c30
78: 0x7fef2c451d3c - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtPrivExt>::predicate_can_apply::hb7fe73a96fe82161
79: 0x7fef2c44be09 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_selection_error::h539e53eede9face4
80: 0x7fef2c447f67 - <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::error_reporting::InferCtxtExt>::report_fulfillment_errors::h14d0e8bab898c5c6
81: 0x7fef2c901297 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types::h77ab27cd91dd6c3a
82: 0x7fef2c8ffbd7 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_method_argument_types::h4868a094e1ee7843
83: 0x7fef2c8ec5b2 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind::h847ee349f779d14a
84: 0x7fef2c8eb765 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h8c0cb080ad6933ce
85: 0x7fef2c9031a9 - rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected::h3d043f9e26a99125
86: 0x7fef2c8eb765 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation::h8c0cb080ad6933ce
87: 0x7fef2c8f70b3 - rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr::h9577da4ea7b48df9
88: 0x7fef2c9c388a - rustc_typeck::check::check::check_fn::he9427b824b1bee31
89: 0x7fef2c98a8df - rustc_infer::infer::InferCtxtBuilder::enter::h10bfca448b8abe65
90: 0x7fef2c9dade9 - rustc_typeck::check::typeck::h9d473560c90e8eac
91: 0x7fef2cb0a8ac - rustc_query_system::query::plumbing::get_query_impl::hb2ddc440783de3e4
92: 0x7fef2cb51b1b - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck::h20e7e18fe4adf547
93: 0x7fef2c9459ba - rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners::hfe38da49ef8fae21
94: 0x7fef2d4a1a4c - rustc_typeck::check::typeck_item_bodies::h84f6dc7a319dd44a
95: 0x7fef2d56aa0b - rustc_query_system::query::plumbing::get_query_impl::h2372b8eda1752700
96: 0x7fef2d631790 - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies::h49264e150777de1e
97: 0x7fef2d438b6f - rustc_session::utils::<impl rustc_session::session::Session>::time::hb04bad2c59296de9
98: 0x7fef2d4cd287 - rustc_typeck::check_crate::h052f04b1c455d412
99: 0x7fef2d2290ef - rustc_interface::passes::analysis::h57734cd964f56f31
100: 0x7fef2d5984a9 - rustc_query_system::query::plumbing::get_query_impl::hcbbfd8ecd4ff870b
101: 0x7fef2d62f70d - <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis::hbd79061f78fee3dc
102: 0x7fef2d1fe6a2 - rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter::h322d262b9c0938c4
103: 0x7fef2d1ed79c - rustc_span::with_source_map::hef536b13581cfdf1
104: 0x7fef2d1ff87a - rustc_interface::interface::create_compiler_and_run::h268d650d50fb09f1
105: 0x7fef2d1f29c9 - scoped_tls::ScopedKey<T>::set::h01e1202900a6e691
106: 0x7fef2d1ef8aa - std::sys_common::backtrace::__rust_begin_short_backtrace::h32f903e490a897c1
107: 0x7fef2d1ee135 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h3ecb73c3653fe1a0
108: 0x7fef2af54a17 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::ha8b1d5a0092467fc
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/alloc/src/boxed.rs:1572:9
109: 0x7fef2af54a17 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h4b9f24ec4e8a879e
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/alloc/src/boxed.rs:1572:9
110: 0x7fef2af54a17 - std::sys::unix::thread::Thread::new::thread_start::h2a0e98fbc4ab4c32
at /rustc/955b9c0d4cd9176b53f518e01cbe175545c69947/library/std/src/sys/unix/thread.rs:74:17
111: 0x7fef2ae8e609 - start_thread
112: 0x7fef2ada2293 - clone
113: 0x0 - <unknown>
Edit: fixed link.
Metadata
Metadata
Assignees
Labels
Area: const generics (parameters and arguments)Category: This is a bug.`#![feature(const_generics)]``#![feature(generic_const_exprs)]`Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.