Repository navigation
ICE with generic_const_exprs and adt_const_params #97047
Copy link
Copy link
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-adt_const_params`#![feature(adt_const_params)]``#![feature(adt_const_params)]`F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Description
Activity
- addedC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on May 14, 2022 A reduced version:
#![feature(adt_const_params, generic_const_exprs)] pub struct Changes<const CHANGES: &'static [&'static str]> where [(); CHANGES.len()]:, { changes: [usize; CHANGES.len()], } impl<const CHANGES: &'static [&'static str]> Changes<CHANGES> where [(); CHANGES.len()]:, { pub const fn new() -> Self { Self { changes: [0; CHANGES.len()], } } }
Error message
error: internal compiler error: no errors encountered even though `delay_span_bug` issued error: internal compiler error: broken MIR in DefId(0:11 ~ playground[c737]::{impl#0}::new) (NoSolution): could not prove Binder(ConstEvaluatable(WithOptConstParam { did: DefId(0:5 ~ playground[c737]::Changes::{constant#0}), const_param_did: None }, [Const { ty: &[&str], val: Param(CHANGES/#0) }]), []) [--> src/lib.rs:15:9 ](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021#) | 15 | / Self { 16 | | changes: [0; CHANGES.len()], 17 | | } | |_________^ | = note: delayed at compiler/rustc_borrowck/src/type_check/canonical.rs:149:13 thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1369:13 stack backtrace: 0: 0x7f2991265fbd - std::backtrace_rs::backtrace::libunwind::trace::hfff13da9629808b3 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5 1: 0x7f2991265fbd - std::backtrace_rs::backtrace::trace_unsynchronized::h574c052d104edbb2 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x7f2991265fbd - std::sys_common::backtrace::_print_fmt::hdec7c42a9aaff178 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/sys_common/backtrace.rs:66:5 3: 0x7f2991265fbd - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h7b437db464fe2eae at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/sys_common/backtrace.rs:45:22 4: 0x7f29912c1c4c - core::fmt::write::ha127ca1dd987811c at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/core/src/fmt/mod.rs:1196:17 5: 0x7f2991257731 - std::io::Write::write_fmt::haed364b23f647916 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/io/mod.rs:1654:15 6: 0x7f2991268cd5 - std::sys_common::backtrace::_print::hb1db8a563e06b2cc at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/sys_common/backtrace.rs:48:5 7: 0x7f2991268cd5 - std::sys_common::backtrace::print::h16e06d5c2185a605 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/sys_common/backtrace.rs:35:9 8: 0x7f2991268cd5 - std::panicking::default_hook::{{closure}}::hc4512ccdd0ac08a5 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/panicking.rs:295:22 9: 0x7f2991268949 - std::panicking::default_hook::hf0d6585cd7a26bd4 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/panicking.rs:314:9 10: 0x7f2991a2dff1 - rustc_driver[8ee73bb5f36af3de]::DEFAULT_HOOK::{closure#0}::{closure#0} 11: 0x7f29912694a6 - std::panicking::rust_panic_with_hook::hb5d5e6f805719e75 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/panicking.rs:702:17 12: 0x7f2992ba9cd1 - std[ac1b39edc8935404]::panicking::begin_panic::<rustc_errors[7358869d503cdbaa]::ExplicitBug>::{closure#0} 13: 0x7f2992ba9c36 - std[ac1b39edc8935404]::sys_common::backtrace::__rust_end_short_backtrace::<std[ac1b39edc8935404]::panicking::begin_panic<rustc_errors[7358869d503cdbaa]::ExplicitBug>::{closure#0}, !> 14: 0x7f2992bad906 - std[ac1b39edc8935404]::panicking::begin_panic::<rustc_errors[7358869d503cdbaa]::ExplicitBug> 15: 0x7f2992bb19e6 - std[ac1b39edc8935404]::panic::panic_any::<rustc_errors[7358869d503cdbaa]::ExplicitBug> 16: 0x7f2994370c41 - <rustc_errors[7358869d503cdbaa]::HandlerInner as core[295e1f7691ff5442]::ops::drop::Drop>::drop 17: 0x7f2993ac4198 - core[295e1f7691ff5442]::ptr::drop_in_place::<rustc_session[ff20e138b897b605]::parse::ParseSess> 18: 0x7f2993ac64b3 - <alloc[94313895c08d63e9]::rc::Rc<rustc_session[ff20e138b897b605]::session::Session> as core[295e1f7691ff5442]::ops::drop::Drop>::drop 19: 0x7f2993ac306d - core[295e1f7691ff5442]::ptr::drop_in_place::<rustc_interface[d033f7e4bca3d7ee]::interface::Compiler> 20: 0x7f2993ac29d4 - rustc_span[14222bfc8ecd5677]::with_source_map::<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_interface[d033f7e4bca3d7ee]::interface::create_compiler_and_run<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_driver[8ee73bb5f36af3de]::run_compiler::{closure#1}>::{closure#1}> 21: 0x7f2993aae0c4 - rustc_interface[d033f7e4bca3d7ee]::interface::create_compiler_and_run::<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_driver[8ee73bb5f36af3de]::run_compiler::{closure#1}> 22: 0x7f2993a98692 - <scoped_tls[2d60114f458dc383]::ScopedKey<rustc_span[14222bfc8ecd5677]::SessionGlobals>>::set::<rustc_interface[d033f7e4bca3d7ee]::interface::run_compiler<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_driver[8ee73bb5f36af3de]::run_compiler::{closure#1}>::{closure#0}, core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>> 23: 0x7f2993aaf7bf - std[ac1b39edc8935404]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[d033f7e4bca3d7ee]::util::run_in_thread_pool_with_globals<rustc_interface[d033f7e4bca3d7ee]::interface::run_compiler<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_driver[8ee73bb5f36af3de]::run_compiler::{closure#1}>::{closure#0}, core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>>::{closure#0}, core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>> 24: 0x7f2993aaf8f9 - <<std[ac1b39edc8935404]::thread::Builder>::spawn_unchecked_<rustc_interface[d033f7e4bca3d7ee]::util::run_in_thread_pool_with_globals<rustc_interface[d033f7e4bca3d7ee]::interface::run_compiler<core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>, rustc_driver[8ee73bb5f36af3de]::run_compiler::{closure#1}>::{closure#0}, core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>>::{closure#0}, core[295e1f7691ff5442]::result::Result<(), rustc_errors[7358869d503cdbaa]::ErrorGuaranteed>>::{closure#1} as core[295e1f7691ff5442]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0} 25: 0x7f29912733c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h54f496eb95d11bdf at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/alloc/src/boxed.rs:1872:9 26: 0x7f29912733c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6d49434441582c00 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/alloc/src/boxed.rs:1872:9 27: 0x7f29912733c3 - std::sys::unix::thread::Thread::new::thread_start::hbff7f546b16d10d6 at /rustc/f1f721e64014863f41c1a386b04af04c2de25321/library/std/src/sys/unix/thread.rs:108:17 28: 0x7f29911a3609 - start_thread 29: 0x7f29910bc133 - clone 30: 0x0 - <unknown> 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.62.0-nightly (f1f721e64 2022-05-13) running on x86_64-unknown-linux-gnu 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: end of query stackRust version
Tested in play.rust-lang.org using
1.62.0-nightly (2022-05-13 f1f721e64014863f41c1)The other ICE block is also standalone
#![feature(adt_const_params, generic_const_exprs)] pub struct Changes<const CHANGES: &'static [&'static str]> where [(); CHANGES.len()]:, { changes: [usize; CHANGES.len()], } impl<const CHANGES: &'static [&'static str]> Changes<CHANGES> where [(); CHANGES.len()]:, { pub fn combine(&mut self, other: &Self) { for _change in &self.changes {} } }
error: internal compiler error: no errors encountered even though `delay_span_bug` issued error: internal compiler error: broken MIR in DefId(0:7397 ~ cranial_coitus[a396]::passes::utils::changes::{impl#1}::combine) (NoSolution): could not prove Binder(WellFormed(&[usize; _]), []) --> src\passes\utils\changes.rs:75:24 | 75 | for _change in &self.changes {} | ^^^^^^^^^^^^^ | = note: delayed at compiler\rustc_borrowck\src\type_check\canonical.rs:149:13 thread 'rustc' panicked at 'Box<dyn Any>', compiler\rustc_errors\src\lib.rs:1369:13 stack backtrace: 0: 0x7ff8fe65988f - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h19d347d7cfe5cdb5 1: 0x7ff8fe69496a - core::fmt::write::ha4c3b8e240caf9f6 2: 0x7ff8fe64bea9 - <std::io::IoSlice as core::fmt::Debug>::fmt::hc3dee57d919433ff 3: 0x7ff8fe65d07b - std::panicking::default_hook::h4544884403d9be85 4: 0x7ff8fe65cc6e - std::panicking::default_hook::h4544884403d9be85 5: 0x7ff8cb47e8c9 - <rustc_middle[dba4d5507afbab0d]::ty::SymbolName as core[eee2e1d8d36d089]::fmt::Debug>::fmt 6: 0x7ff8fe65d95a - std::panicking::rust_panic_with_hook::hc1cc4992a4b6ec1b 7: 0x7ff8cfbe3055 - <rustc_errors[a795d8b482c20b3d]::diagnostic_builder::DiagnosticBuilderInner as core[eee2e1d8d36d089]::ops::drop::Drop>::drop 8: 0x7ff8cfbe3009 - <rustc_errors[a795d8b482c20b3d]::diagnostic_builder::DiagnosticBuilderInner as core[eee2e1d8d36d089]::ops::drop::Drop>::drop 9: 0x7ff8cff29399 - rustc_query_system[a0b9f5f0299a8a38]::query::plumbing::incremental_verify_ich_cold 10: 0x7ff8cfbd5629 - <rustc_feature[ea871e0fc9abb418]::builtin_attrs::AttributeType as core[eee2e1d8d36d089]::fmt::Debug>::fmt 11: 0x7ff8cfbd9288 - <rustc_errors[a795d8b482c20b3d]::HandlerInner as core[eee2e1d8d36d089]::ops::drop::Drop>::drop 12: 0x7ff8cb4a5794 - rustc_driver[dba66f49bbdf914a]::pretty::print_after_hir_lowering 13: 0x7ff8cb4a8bca - rustc_driver[dba66f49bbdf914a]::pretty::print_after_hir_lowering 14: 0x7ff8cb493ecd - rustc_driver[dba66f49bbdf914a]::pretty::print_after_hir_lowering 15: 0x7ff8cb491bf9 - rustc_driver[dba66f49bbdf914a]::pretty::print_after_hir_lowering 16: 0x7ff8cb42f540 - <rustc_codegen_ssa[a427f0aa3144ff71]::back::linker::PtxLinker as rustc_codegen_ssa[a427f0aa3144ff71]::back::linker::Linker>::no_default_libraries 17: 0x7ff8cb432c27 - <rustc_codegen_ssa[a427f0aa3144ff71]::back::linker::PtxLinker as rustc_codegen_ssa[a427f0aa3144ff71]::back::linker::Linker>::no_default_libraries 18: 0x7ff8cb43c876 - <rustc_driver[dba66f49bbdf914a]::args::Error as core[eee2e1d8d36d089]::fmt::Debug>::fmt 19: 0x7ff8cb43d998 - <rustc_driver[dba66f49bbdf914a]::args::Error as core[eee2e1d8d36d089]::fmt::Debug>::fmt 20: 0x7ff8fe66edec - std::sys::windows::thread::Thread::new::h1883b00da4b4f517 21: 0x7ff95ba97034 - BaseThreadInitThunk 22: 0x7ff95d2a2651 - RtlUserThreadStart 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.62.0-nightly (6dd68402c 2022-05-11) running on x86_64-pc-windows-msvc note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental note: some of the compiler flags provided by cargo are hidden query stack during panic: end of query stackfor the first example:
#![feature(adt_const_params, generic_const_exprs)] pub struct Changes<const CHANGES: &'static [&'static str]> where [(); CHANGES.len()]:, { changes: [usize; CHANGES.len()], } impl<const CHANGES: &'static [&'static str]> Changes<CHANGES> where [(); CHANGES.len()]:, { pub const fn new() -> Self { Self { changes: [0; CHANGES.len()], } } }
searched toolchains nightly-2021-12-01 through nightly-2022-05-12 Regression in nightly-2021-12-06searched toolchains efec545293b9263be9edfb283a7aa66350b3acbf through e2116acae59654bfab2a9729a024f3e2fd6d4b02Regression in 772d51f 🤔
EDIT: same for the second snippet.
This is caused by #90529. Seems as if this issue takes care of this FIXME ^^.
Not sure what the right solution is, we originally tried to skip reborrows because implicit autorefs/autoderefs lead to confusing error messages given that we don't support derefs and refs in abstract consts. Maybe the right solution is to just clarify that autorefs/autoderefs happen there. Thoughts @lcnr?
- addedglacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
on May 21, 2022 - addedF-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`F-adt_const_params`#![feature(adt_const_params)]``#![feature(adt_const_params)]`
on Jun 24, 2022 - addedE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
on Jun 30, 2022 - added a commit that references this issue
on Jun 30, 2022 - added a commit that references this issue
on Jul 2, 2022
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.F-adt_const_params`#![feature(adt_const_params)]``#![feature(adt_const_params)]`F-generic_const_exprs`#![feature(generic_const_exprs)]``#![feature(generic_const_exprs)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
Code
Meta
rustc --version --verbose:Error output
Backtrace