Skip to content

ICE: wfchk: type parameter .. out of range when instantiating, args=[{const error}] #126182

@matthiaskrgr

Description

@matthiaskrgr

auto-reduced (treereduce-rust):

#![feature(generic_const_exprs)] trait Ret { type R; } struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>); struct RobinHashTable<const MAX_LENGTH: usize, CellIdx = <Cond<{}, usize, u32> as Ret>::R> {} impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} 

original:

#![feature(generic_const_exprs)] trait Ret { type R; } struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>, ); struct RobinHashTable< const MAX_LENGTH: usize, CellIdx = <Cond<{ }, usize, u32> as Ret>::R, > {} impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {}

Version information

rustc 1.81.0-nightly (13423befc 2024-06-09) binary: rustc commit-hash: 13423befc40fffe23ccc6dd06868142cff9428fe commit-date: 2024-06-09 host: x86_64-unknown-linux-gnu release: 1.81.0-nightly LLVM version: 18.1.7 

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc

Program output

error[E0405]: cannot find trait `HashMapBase` in this scope --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:15 | 11 | impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} | ^^^^^^^^^^^ not found in this scope error[E0412]: cannot find type `MAX_LENGTH` in this scope --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:55 | 11 | impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} | ^^^^^^^^^^ not found in this scope | help: you might be missing a type parameter | 11 | impl<CellIdx, MAX_LENGTH> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} | ++++++++++++ warning: the feature `generic_const_exprs` is incomplete and may not be safe to use and/or cause compiler crashes --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:1:12 | 1 | #![feature(generic_const_exprs)] | ^^^^^^^^^^^^^^^^^^^ | = note: see issue #76560 <https://github.com/rust-lang/rust/issues/76560> for more information = note: `#[warn(incomplete_features)]` on by default error[E0601]: `main` function not found in crate `mvce` --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:78 | 11 | impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} | ^ consider adding a `main` function to `/tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs` error[E0392]: type parameter `V` is never used --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:7:34 | 7 | struct Cond<const PRED: bool, U, V>(std::marker::PhantomData<U>); | ^ unused type parameter | = help: consider removing `V`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `V` to be a const parameter, use `const V: /* Type */` instead error[E0308]: mismatched types --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:9:64 | 9 | struct RobinHashTable<const MAX_LENGTH: usize, CellIdx = <Cond<{}, usize, u32> as Ret>::R> {} | ^^ expected `bool`, found `()` error[E0392]: type parameter `CellIdx` is never used --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:9:48 | 9 | struct RobinHashTable<const MAX_LENGTH: usize, CellIdx = <Cond<{}, usize, u32> as Ret>::R> {} | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused type parameter | = help: consider removing `CellIdx`, referring to it in a field, or using a marker such as `PhantomData` = help: if you intended `CellIdx` to be a const parameter, use `const CellIdx: /* Type */` instead error[E0747]: unresolved item provided when a constant was expected --> /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:55 | 11 | impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<MAX_LENGTH, CellIdx> {} | ^^^^^^^^^^ | help: if this generic argument was intended as a const parameter, surround it with braces | 11 | impl<CellIdx> HashMapBase<CellIdx> for RobinHashTable<{ MAX_LENGTH }, CellIdx> {} | + + thread 'rustc' panicked at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/compiler/rustc_type_ir/src/binder.rs:721:9: type parameter `CellIdx/#1` (CellIdx/#1/1) out of range when instantiating, args=[{const error}] stack backtrace: 0: 0x7a5d7b004f15 - std::backtrace_rs::backtrace::libunwind::trace::hc269bfc84eb36e15 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5 1: 0x7a5d7b004f15 - std::backtrace_rs::backtrace::trace_unsynchronized::hece6c4d7a612f15c at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7a5d7b004f15 - std::sys_common::backtrace::_print_fmt::h930816c48dbbaf0d at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7a5d7b004f15 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h97d89f938a66f30a at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7a5d7b055c5b - core::fmt::rt::Argument::fmt::h24d0a17c8139d598 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/core/src/fmt/rt.rs:165:63 5: 0x7a5d7b055c5b - core::fmt::write::ha35330775473ce1b at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/core/src/fmt/mod.rs:1168:21 6: 0x7a5d7aff9bef - std::io::Write::write_fmt::h43aadac447ba03dc at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/io/mod.rs:1835:15 7: 0x7a5d7b004cee - std::sys_common::backtrace::_print::h26d59bbced8ffda1 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7a5d7b004cee - std::sys_common::backtrace::print::ha970e07731260ee4 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7a5d7b007729 - std::panicking::default_hook::{{closure}}::hf9289ff1d818f2e0 10: 0x7a5d7b0074ca - std::panicking::default_hook::h63336b0533014868 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/panicking.rs:298:9 11: 0x7a5d777d7890 - std[6fb11aa7feb46831]::panicking::update_hook::<alloc[34e4e5571b6f83d9]::boxed::Box<rustc_driver_impl[ffae40d8b8d5c74b]::install_ice_hook::{closure#0}>>::{closure#0} 12: 0x7a5d7b007e5b - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hf78a7244bd2d88ce at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/alloc/src/boxed.rs:2077:9 13: 0x7a5d7b007e5b - std::panicking::rust_panic_with_hook::h0b57c3ef0581f5fb at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/panicking.rs:799:13 14: 0x7a5d7b007bd4 - std::panicking::begin_panic_handler::{{closure}}::h3bf6c54ce49c26c2 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/panicking.rs:664:13 15: 0x7a5d7b0053d9 - std::sys_common::backtrace::__rust_end_short_backtrace::h7ebf041d380b46ed at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7a5d7b007907 - rust_begin_unwind at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/panicking.rs:652:5 17: 0x7a5d7b0521f3 - core::panicking::panic_fmt::hea580bf65fedee8d at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/core/src/panicking.rs:72:14 18: 0x7a5d778da789 - <rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::type_param_out_of_range 19: 0x7a5d792ee2ea - <rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::fold_ty 20: 0x7a5d792ed0a6 - <&rustc_middle[d7453cc9d163243f]::ty::list::RawList<(), rustc_middle[d7453cc9d163243f]::ty::generic_args::GenericArg> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFoldable<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>> 21: 0x7a5d79e249ae - <rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::fold_const.warm 22: 0x7a5d792ee267 - <rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::fold_ty 23: 0x7a5d792ed015 - <&rustc_middle[d7453cc9d163243f]::ty::list::RawList<(), rustc_middle[d7453cc9d163243f]::ty::generic_args::GenericArg> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFoldable<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::try_fold_with::<rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>> 24: 0x7a5d792ed6ac - <rustc_type_ir[f61c5ba52dab4f78]::binder::ArgFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder<rustc_middle[d7453cc9d163243f]::ty::context::TyCtxt>>::fold_ty 25: 0x7a5d78f0c939 - <<dyn rustc_hir_analysis[1c7651ca8b7a2f4f]::hir_ty_lowering::HirTyLowerer>::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis[1c7651ca8b7a2f4f]::hir_ty_lowering::GenericArgsLowerer>::inferred_kind 26: 0x7a5d767cdd2a - <dyn rustc_hir_analysis[1c7651ca8b7a2f4f]::hir_ty_lowering::HirTyLowerer>::lower_path 27: 0x7a5d79199197 - <dyn rustc_hir_analysis[1c7651ca8b7a2f4f]::hir_ty_lowering::HirTyLowerer>::lower_ty_common::{closure#0} 28: 0x7a5d7674409b - rustc_hir_analysis[1c7651ca8b7a2f4f]::collect::type_of::type_of 29: 0x7a5d78dd0c2a - rustc_query_impl[1410ec32161e1f70]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1410ec32161e1f70]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 8usize]>> 30: 0x7a5d78dcf81b - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::<rustc_query_impl[1410ec32161e1f70]::DynamicConfig<rustc_query_system[71bc59e02034b9b1]::query::caches::DefIdCache<rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[1410ec32161e1f70]::plumbing::QueryCtxt, false> 31: 0x7a5d78dcf3bb - rustc_query_impl[1410ec32161e1f70]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace 32: 0x7a5d78f9efcf - <rustc_hir_analysis[1c7651ca8b7a2f4f]::collect::CollectItemTypesVisitor as rustc_hir[b11a8aea6cdb8d1a]::intravisit::Visitor>::visit_item 33: 0x7a5d7675f6c0 - rustc_hir_analysis[1c7651ca8b7a2f4f]::check::wfcheck::check_well_formed 34: 0x7a5d791c52a9 - rustc_query_impl[1410ec32161e1f70]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1410ec32161e1f70]::query_impl::check_well_formed::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>> 35: 0x7a5d791c5526 - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::<rustc_query_impl[1410ec32161e1f70]::DynamicConfig<rustc_query_system[71bc59e02034b9b1]::query::caches::VecCache<rustc_hir[b11a8aea6cdb8d1a]::hir_id::OwnerId, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1410ec32161e1f70]::plumbing::QueryCtxt, false> 36: 0x7a5d791c5286 - rustc_query_impl[1410ec32161e1f70]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 37: 0x7a5d791c6009 - rustc_hir_analysis[1c7651ca8b7a2f4f]::check::wfcheck::check_mod_type_wf 38: 0x7a5d791c5e4f - rustc_query_impl[1410ec32161e1f70]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1410ec32161e1f70]::query_impl::check_mod_type_wf::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>> 39: 0x7a5d7972c1fa - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::<rustc_query_impl[1410ec32161e1f70]::DynamicConfig<rustc_query_system[71bc59e02034b9b1]::query::caches::DefaultCache<rustc_span[3fc851bceb4adf61]::def_id::LocalModDefId, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1410ec32161e1f70]::plumbing::QueryCtxt, false> 40: 0x7a5d7972bfb5 - rustc_query_impl[1410ec32161e1f70]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace 41: 0x7a5d78ff37ea - rustc_hir_analysis[1c7651ca8b7a2f4f]::check_crate 42: 0x7a5d791ba8be - rustc_interface[f4a2ea540be086e6]::passes::analysis 43: 0x7a5d791ba41b - rustc_query_impl[1410ec32161e1f70]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[1410ec32161e1f70]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>> 44: 0x7a5d799cdda5 - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::<rustc_query_impl[1410ec32161e1f70]::DynamicConfig<rustc_query_system[71bc59e02034b9b1]::query::caches::SingleCache<rustc_middle[d7453cc9d163243f]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[1410ec32161e1f70]::plumbing::QueryCtxt, false> 45: 0x7a5d799cdb0f - rustc_query_impl[1410ec32161e1f70]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 46: 0x7a5d7984f692 - rustc_interface[f4a2ea540be086e6]::interface::run_compiler::<core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>, rustc_driver_impl[ffae40d8b8d5c74b]::run_compiler::{closure#0}>::{closure#1} 47: 0x7a5d79804f67 - std[6fb11aa7feb46831]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[f4a2ea540be086e6]::util::run_in_thread_with_globals<rustc_interface[f4a2ea540be086e6]::util::run_in_thread_pool_with_globals<rustc_interface[f4a2ea540be086e6]::interface::run_compiler<core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>, rustc_driver_impl[ffae40d8b8d5c74b]::run_compiler::{closure#0}>::{closure#1}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>>::{closure#0}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>> 48: 0x7a5d79804d2a - <<std[6fb11aa7feb46831]::thread::Builder>::spawn_unchecked_<rustc_interface[f4a2ea540be086e6]::util::run_in_thread_with_globals<rustc_interface[f4a2ea540be086e6]::util::run_in_thread_pool_with_globals<rustc_interface[f4a2ea540be086e6]::interface::run_compiler<core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>, rustc_driver_impl[ffae40d8b8d5c74b]::run_compiler::{closure#0}>::{closure#1}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>>::{closure#0}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[b05d301dbc549eb0]::result::Result<(), rustc_span[3fc851bceb4adf61]::ErrorGuaranteed>>::{closure#2} as core[b05d301dbc549eb0]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 49: 0x7a5d7b011e4b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::he97bec9b57692eb6 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/alloc/src/boxed.rs:2063:9 50: 0x7a5d7b011e4b - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h5ef09d5fe1e7a265 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/alloc/src/boxed.rs:2063:9 51: 0x7a5d7b011e4b - std::sys::pal::unix::thread::Thread::new::thread_start::h71e84f01f2e92ad3 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/std/src/sys/pal/unix/thread.rs:108:17 52: 0x7a5d744a6ded - <unknown> 53: 0x7a5d7452a0dc - <unknown> 54: 0x0 - <unknown> error: 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: please make sure that you have updated to the latest nightly note: rustc 1.81.0-nightly (13423befc 2024-06-09) running on x86_64-unknown-linux-gnu query stack during panic: #0 [type_of] computing type of `<impl at /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:1: 11:75>` #1 [check_well_formed] checking that `<impl at /tmp/icemaker_global_tempdir.7MOg4WzJ7ybU/rustc_testrunner_tmpdir_reporting.HyzgwWnQ2tfu/mvce.rs:11:1: 11:75>` is well-formed end of query stack error: aborting due to 7 previous errors; 1 warning emitted Some errors have detailed explanations: E0308, E0392, E0405, E0412, E0601, E0747. For more information about an error, try `rustc --explain E0308`. 

@rustbot label +F-generic_const_exprs

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.F-generic_const_exprs`#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions