rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.03k stars 12.54k forks source link

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

Open matthiaskrgr opened 3 months ago

matthiaskrgr commented 3 months ago

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 HashMapBase for RobinHashTable {} | ^^^^^^^^^^^ 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 HashMapBase for RobinHashTable {} | ^^^^^^^^^^ not found in this scope | help: you might be missing a type parameter | 11 | impl HashMapBase for RobinHashTable {} | ++++++++++++ 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 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 HashMapBase for RobinHashTable {} | ^ 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(std::marker::PhantomData); | ^ 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 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 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 HashMapBase for RobinHashTable {} | ^^^^^^^^^^ | help: if this generic argument was intended as a const parameter, surround it with braces | 11 | impl HashMapBase 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 - ::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::>::{closure#0} 12: 0x7a5d7b007e5b - as core::ops::function::Fn>::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 - >::type_param_out_of_range 19: 0x7a5d792ee2ea - as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder>::fold_ty 20: 0x7a5d792ed0a6 - <&rustc_middle[d7453cc9d163243f]::ty::list::RawList<(), rustc_middle[d7453cc9d163243f]::ty::generic_args::GenericArg> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFoldable>::try_fold_with::> 21: 0x7a5d79e249ae - as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder>::fold_const.warm 22: 0x7a5d792ee267 - as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder>::fold_ty 23: 0x7a5d792ed015 - <&rustc_middle[d7453cc9d163243f]::ty::list::RawList<(), rustc_middle[d7453cc9d163243f]::ty::generic_args::GenericArg> as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFoldable>::try_fold_with::> 24: 0x7a5d792ed6ac - as rustc_type_ir[f61c5ba52dab4f78]::fold::TypeFolder>::fold_ty 25: 0x7a5d78f0c939 - <::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis[1c7651ca8b7a2f4f]::hir_ty_lowering::GenericArgsLowerer>::inferred_kind 26: 0x7a5d767cdd2a - ::lower_path 27: 0x7a5d79199197 - ::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::> 30: 0x7a5d78dcf81b - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::>, 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 - ::visit_item 33: 0x7a5d7675f6c0 - rustc_hir_analysis[1c7651ca8b7a2f4f]::check::wfcheck::check_well_formed 34: 0x7a5d791c52a9 - rustc_query_impl[1410ec32161e1f70]::plumbing::__rust_begin_short_backtrace::> 35: 0x7a5d791c5526 - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::>, 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::> 39: 0x7a5d7972c1fa - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::>, 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::> 44: 0x7a5d799cdda5 - rustc_query_system[71bc59e02034b9b1]::query::plumbing::try_execute_query::>, 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::, rustc_driver_impl[ffae40d8b8d5c74b]::run_compiler::{closure#0}>::{closure#1} 47: 0x7a5d79804f67 - std[6fb11aa7feb46831]::sys_common::backtrace::__rust_begin_short_backtrace::, 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 - <::spawn_unchecked_, 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 - as core::ops::function::FnOnce>::call_once::he97bec9b57692eb6 at /rustc/13423befc40fffe23ccc6dd06868142cff9428fe/library/alloc/src/boxed.rs:2063:9 50: 0x7a5d7b011e4b - as core::ops::function::FnOnce>::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 - 53: 0x7a5d7452a0dc - 54: 0x0 - 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 `` #1 [check_well_formed] checking that `` 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

theemathas commented 3 months ago

Minimized:

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

struct Cond<const B: bool>;

struct Thing<T = Cond<0>>(T);

impl Thing {}
Compiler output ``` Compiling playground v0.0.1 (/playground) error[E0308]: mismatched types --> src/lib.rs:6:23 | 6 | struct Thing>(T); | ^ expected `bool`, found integer thread 'rustc' panicked at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/compiler/rustc_type_ir/src/binder.rs:721:9: type parameter `T/#0` (T/#0/0) out of range when instantiating, args=[] stack backtrace: 0: 0x7fafbbd3ff15 - std::backtrace_rs::backtrace::libunwind::trace::hfca91910e8bd6208 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5 1: 0x7fafbbd3ff15 - std::backtrace_rs::backtrace::trace_unsynchronized::h5a4f6fc8cd78f634 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7fafbbd3ff15 - std::sys_common::backtrace::_print_fmt::h5d0b0e53bade0c48 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys_common/backtrace.rs:68:5 3: 0x7fafbbd3ff15 - ::fmt::h19ae2d3e45efa1aa at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys_common/backtrace.rs:44:22 4: 0x7fafbbd90c5b - core::fmt::rt::Argument::fmt::h56833048848af921 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/core/src/fmt/rt.rs:165:63 5: 0x7fafbbd90c5b - core::fmt::write::h73ea2fd46689cbd2 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/core/src/fmt/mod.rs:1168:21 6: 0x7fafbbd34bef - std::io::Write::write_fmt::h57421db57be4d88a at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/io/mod.rs:1835:15 7: 0x7fafbbd3fcee - std::sys_common::backtrace::_print::h49b789ad9bc424ff at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys_common/backtrace.rs:47:5 8: 0x7fafbbd3fcee - std::sys_common::backtrace::print::h30b346ab119f042f at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys_common/backtrace.rs:34:9 9: 0x7fafbbd42729 - std::panicking::default_hook::{{closure}}::hac3e4c7a36a1e544 10: 0x7fafbbd424ca - std::panicking::default_hook::h36c5bd5715913de7 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/panicking.rs:298:9 11: 0x7fafbef8d100 - std[a54bcd08e7411830]::panicking::update_hook::>::{closure#0} 12: 0x7fafbbd42e5b - as core::ops::function::Fn>::call::hb1741174b795cf35 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/alloc/src/boxed.rs:2077:9 13: 0x7fafbbd42e5b - std::panicking::rust_panic_with_hook::hf07571b7e9d43806 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/panicking.rs:799:13 14: 0x7fafbbd42bd4 - std::panicking::begin_panic_handler::{{closure}}::hdc742db4bd338eb8 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/panicking.rs:664:13 15: 0x7fafbbd403d9 - std::sys_common::backtrace::__rust_end_short_backtrace::h2d0cc130f1c87c64 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys_common/backtrace.rs:171:18 16: 0x7fafbbd42907 - rust_begin_unwind at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/panicking.rs:652:5 17: 0x7fafbbd8d1f3 - core::panicking::panic_fmt::hc9533aa472778eef at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/core/src/panicking.rs:72:14 18: 0x7fafbf08fff9 - >::type_param_out_of_range 19: 0x7fafc0a73c6a - as rustc_type_ir[92f743e515eeefed]::fold::TypeFolder>::fold_ty 20: 0x7fafc0a72995 - <&rustc_middle[b41b0863c4e23e8a]::ty::list::RawList<(), rustc_middle[b41b0863c4e23e8a]::ty::generic_args::GenericArg> as rustc_type_ir[92f743e515eeefed]::fold::TypeFoldable>::try_fold_with::> 21: 0x7fafc15d6f02 - as rustc_type_ir[92f743e515eeefed]::fold::TypeFolder>::fold_const.warm 22: 0x7fafc0a7322f - as rustc_type_ir[92f743e515eeefed]::fold::TypeFolder>::fold_ty 23: 0x7fafc06acf79 - <::lower_generic_args_of_path::{closure#0}::GenericArgsCtxt as rustc_hir_analysis[6b7f69c937aac3d5]::hir_ty_lowering::GenericArgsLowerer>::inferred_kind 24: 0x7fafbdfc2d2a - ::lower_path 25: 0x7fafc099de17 - ::lower_ty_common::{closure#0} 26: 0x7fafbddc165b - rustc_hir_analysis[6b7f69c937aac3d5]::collect::type_of::type_of 27: 0x7fafc059c82a - rustc_query_impl[b746354c2bcfb267]::plumbing::__rust_begin_short_backtrace::> 28: 0x7fafc059b427 - rustc_query_system[6e6ff034b5afc6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[b746354c2bcfb267]::plumbing::QueryCtxt, false> 29: 0x7fafc059afe7 - rustc_query_impl[b746354c2bcfb267]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace 30: 0x7fafc073eb8f - ::visit_item 31: 0x7fafbdddccc0 - rustc_hir_analysis[6b7f69c937aac3d5]::check::wfcheck::check_well_formed 32: 0x7fafc092c1e9 - rustc_query_impl[b746354c2bcfb267]::plumbing::__rust_begin_short_backtrace::> 33: 0x7fafc092c466 - rustc_query_system[6e6ff034b5afc6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[b746354c2bcfb267]::plumbing::QueryCtxt, false> 34: 0x7fafc092c1c6 - rustc_query_impl[b746354c2bcfb267]::query_impl::check_well_formed::get_query_non_incr::__rust_end_short_backtrace 35: 0x7fafc092cf37 - rustc_hir_analysis[6b7f69c937aac3d5]::check::wfcheck::check_mod_type_wf 36: 0x7fafc092cd7b - rustc_query_impl[b746354c2bcfb267]::plumbing::__rust_begin_short_backtrace::> 37: 0x7fafc0edc6fa - rustc_query_system[6e6ff034b5afc6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[b746354c2bcfb267]::plumbing::QueryCtxt, false> 38: 0x7fafc0edc4b5 - rustc_query_impl[b746354c2bcfb267]::query_impl::check_mod_type_wf::get_query_non_incr::__rust_end_short_backtrace 39: 0x7fafc07966ea - rustc_hir_analysis[6b7f69c937aac3d5]::check_crate 40: 0x7fafc09217fe - rustc_interface[b431ae828ca0cbb1]::passes::analysis 41: 0x7fafc092135b - rustc_query_impl[b746354c2bcfb267]::plumbing::__rust_begin_short_backtrace::> 42: 0x7fafc11fad65 - rustc_query_system[6e6ff034b5afc6]::query::plumbing::try_execute_query::>, false, false, false>, rustc_query_impl[b746354c2bcfb267]::plumbing::QueryCtxt, false> 43: 0x7fafc11faacf - rustc_query_impl[b746354c2bcfb267]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace 44: 0x7fafc1007512 - rustc_interface[b431ae828ca0cbb1]::interface::run_compiler::, rustc_driver_impl[814eaf686e5216f9]::run_compiler::{closure#0}>::{closure#1} 45: 0x7fafc0fcda67 - std[a54bcd08e7411830]::sys_common::backtrace::__rust_begin_short_backtrace::, rustc_driver_impl[814eaf686e5216f9]::run_compiler::{closure#0}>::{closure#1}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>>::{closure#0}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>> 46: 0x7fafc0fcd82a - <::spawn_unchecked_, rustc_driver_impl[814eaf686e5216f9]::run_compiler::{closure#0}>::{closure#1}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>>::{closure#0}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[bdee16f735ec8991]::result::Result<(), rustc_span[8dc60f5d6165f5e6]::ErrorGuaranteed>>::{closure#2} as core[bdee16f735ec8991]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 47: 0x7fafbbd4ce4b - as core::ops::function::FnOnce>::call_once::h3c82973632029444 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/alloc/src/boxed.rs:2063:9 48: 0x7fafbbd4ce4b - as core::ops::function::FnOnce>::call_once::he2c2231a15a5a037 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/alloc/src/boxed.rs:2063:9 49: 0x7fafbbd4ce4b - std::sys::pal::unix::thread::Thread::new::thread_start::haa4b727517fcd5d2 at /rustc/f21554f7f0ff447b803961c51acafde04553c1ed/library/std/src/sys/pal/unix/thread.rs:108:17 50: 0x7fafbbc5a609 - start_thread 51: 0x7fafbbb7d353 - clone 52: 0x0 - 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: please attach the file at `/playground/rustc-ice-2024-06-09T15_00_43-78.txt` to your bug report note: compiler flags: --crate-type lib -C embed-bitcode=no -C codegen-units=1 -C debuginfo=2 note: some of the compiler flags provided by cargo are hidden query stack during panic: #0 [type_of] computing type of `` #1 [check_well_formed] checking that `` is well-formed end of query stack For more information about this error, try `rustc --explain E0308`. error: could not compile `playground` (lib) due to 1 previous error ```
GrigorenkoPV commented 3 months ago

Minimized:

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

struct Cond<const B: bool>;

struct Thing<T = Cond<0>>(T);

impl Thing {}

Compiler output

This first regresses from correctly giving an error to ICEing in nightly-2021-09-01 (5d6804469d80aaf26f98090ae016af45e267f58f...29ef6cf1637aa8317f8911f93f14e18d404c1b0e)

error: internal compiler error: compiler/rustc_middle/src/ty/subst.rs:534:17: type parameter `T/#0` (T/0) out of range when substituting, substs=[]
 --> src/lib.rs:9:6
  |
9 | impl Thing {}
  |      ^^^^^

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/29ef6cf1637aa8317f8911f93f14e18d404c1b0e/compiler/rustc_errors/src/lib.rs:1093:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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.56.0-nightly (29ef6cf16 2021-08-31) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental -C target-cpu=native -C link-arg=-fuse-ld=mold --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [type_of] computing type of `<impl at src/lib.rs:9:1: 9:14>`
#1 [collect_mod_item_types] collecting item types in top-level module
end of query stack
matthiaskrgr commented 3 months ago

where's the const error though? 😅