Open matthiaskrgr opened 3 months ago
Minimized:
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
struct Cond<const B: bool>;
struct Thing<T = Cond<0>>(T);
impl Thing {}
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
where's the const error though? 😅
auto-reduced (treereduce-rust):
original:
Version information
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