Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: const parameter types cannot be generic #120941

Closed
matthiaskrgr opened this issue Feb 11, 2024 · 1 comment
Closed

ICE: const parameter types cannot be generic #120941

matthiaskrgr opened this issue Feb 11, 2024 · 1 comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@matthiaskrgr
Copy link
Member

Code

#![feature(associated_const_equality, generic_const_items)]

pub fn accept(_: impl Trait<K = 0>) {}

pub trait Trait {
    const K<'a, T: 'a + Copy, const N: usize>: Option<[T; N]> = None
where
    String: From<T>;
}

pub fn main() {}

Meta

rustc --version --verbose:

rustc 1.78.0-nightly (6cc484351 2024-02-10)
binary: rustc
commit-hash: 6cc4843512d613f51ec81aba689180c31b0b28b6
commit-date: 2024-02-10
host: x86_64-unknown-linux-gnu
release: 1.78.0-nightly
LLVM version: 17.0.6

Error output


Backtrace

warning: the feature `generic_const_items` is incomplete and may not be safe to use and/or cause compiler crashes
 --> FC6B3BDBC59A37E6F55C4D01B943A64E13A55DD84FCE5FB628C66A4F8E6C0DC1.rs:1:39
  |
1 | #![feature(associated_const_equality, generic_const_items)]
  |                                       ^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #113521 <https://github.com/rust-lang/rust/issues/113521> for more information
  = note: `#[warn(incomplete_features)]` on by default

thread 'rustc' panicked at compiler/rustc_hir_analysis/src/collect/type_of.rs:101:22:
const parameter types cannot be generic
stack backtrace:
   0:     0x7f1763f8b936 - std::backtrace_rs::backtrace::libunwind::trace::hce337a0fd0c5e1da
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x7f1763f8b936 - std::backtrace_rs::backtrace::trace_unsynchronized::hbc9b4a5cec9b81eb
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7f1763f8b936 - std::sys_common::backtrace::_print_fmt::habe453adcd959f3b
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x7f1763f8b936 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h67bb2d10ecb8af10
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7f1763fde380 - core::fmt::rt::Argument::fmt::hd5debad710e176b4
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/fmt/rt.rs:142:9
   5:     0x7f1763fde380 - core::fmt::write::h5987d5bee25e3bd6
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/fmt/mod.rs:1120:17
   6:     0x7f1763f7f0ef - std::io::Write::write_fmt::h0876e0f4bddb923c
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/io/mod.rs:1854:15
   7:     0x7f1763f8b714 - std::sys_common::backtrace::_print::h4ae69e83d64cbf46
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x7f1763f8b714 - std::sys_common::backtrace::print::h1d97d5831d0262fb
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x7f1763f8e4d7 - std::panicking::default_hook::{{closure}}::h39fabb1b3e65f47a
  10:     0x7f1763f8e239 - std::panicking::default_hook::h416520d6bb2cb53f
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:292:9
  11:     0x7f1766d266dc - std[3acc11fb688f3d76]::panicking::update_hook::<alloc[408654ec2a1215fa]::boxed::Box<rustc_driver_impl[a7481a600b2f11a0]::install_ice_hook::{closure#0}>>::{closure#0}
  12:     0x7f1763f8ec26 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h2450ecbe2b1c1ea3
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2030:9
  13:     0x7f1763f8ec26 - std::panicking::rust_panic_with_hook::h99ef5cbc4b3b0ae4
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:785:13
  14:     0x7f1763f8e972 - std::panicking::begin_panic_handler::{{closure}}::h2284f60633c08873
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:659:13
  15:     0x7f1763f8be36 - std::sys_common::backtrace::__rust_end_short_backtrace::h84bc49437da26b5c
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x7f1763f8e6c4 - rust_begin_unwind
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/panicking.rs:647:5
  17:     0x7f1763fdaa85 - core::panicking::panic_fmt::hfa0af2309df9012f
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/panicking.rs:72:14
  18:     0x7f1763fda833 - core::panicking::panic_display::h5e88803d35c951b0
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/panicking.rs:196:5
  19:     0x7f1763fda833 - core::panicking::panic_str::h1fa7a90d3180c5de
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/panicking.rs:171:5
  20:     0x7f1763fda833 - core::option::expect_failed::hee4b38d562c1aee6
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/core/src/option.rs:1992:5
  21:     0x7f1766557f0f - rustc_hir_analysis[1799a6ccb3095d3d]::collect::type_of::type_of
  22:     0x7f1768075866 - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::type_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 8usize]>>
  23:     0x7f17680744e1 - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefIdCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  24:     0x7f1768073fdd - rustc_query_impl[60cfa4eef1128f6c]::query_impl::type_of::get_query_non_incr::__rust_end_short_backtrace
  25:     0x7f176823af7c - rustc_middle[9f94bb95ba4eb693]::query::plumbing::query_get_at::<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefIdCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 8usize]>>>
  26:     0x7f1768878b56 - <rustc_middle[9f94bb95ba4eb693]::ty::consts::Const>::from_anon_const
  27:     0x7f1768ab8ded - <dyn rustc_hir_analysis[1799a6ccb3095d3d]::astconv::AstConv>::instantiate_poly_trait_ref
  28:     0x7f1768870842 - rustc_hir_analysis[1799a6ccb3095d3d]::collect::predicates_of::gather_explicit_predicates_of
  29:     0x7f1768181aef - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::explicit_predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>
  30:     0x7f1768180d0e - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefIdCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  31:     0x7f1768000260 - rustc_query_impl[60cfa4eef1128f6c]::query_impl::explicit_predicates_of::get_query_non_incr::__rust_end_short_backtrace
  32:     0x7f17680f9e1c - rustc_hir_analysis[1799a6ccb3095d3d]::collect::predicates_defined_on
  33:     0x7f17680f9d13 - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::predicates_defined_on::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>
  34:     0x7f1768180cf6 - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefIdCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  35:     0x7f17681808e0 - rustc_query_impl[60cfa4eef1128f6c]::query_impl::predicates_defined_on::get_query_non_incr::__rust_end_short_backtrace
  36:     0x7f176817f955 - rustc_hir_analysis[1799a6ccb3095d3d]::collect::predicates_of::predicates_of
  37:     0x7f176817f865 - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::predicates_of::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>
  38:     0x7f1768180cc9 - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefIdCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 24usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  39:     0x7f17681809be - rustc_query_impl[60cfa4eef1128f6c]::query_impl::predicates_of::get_query_non_incr::__rust_end_short_backtrace
  40:     0x7f1768384878 - <rustc_hir_analysis[1799a6ccb3095d3d]::collect::CollectItemTypesVisitor as rustc_hir[3813da9c3dbe6953]::intravisit::Visitor>::visit_item
  41:     0x7f1768382b6a - rustc_hir_analysis[1799a6ccb3095d3d]::collect::collect_mod_item_types
  42:     0x7f1768382ae7 - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::collect_mod_item_types::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 0usize]>>
  43:     0x7f1768b2cb7b - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::DefaultCache<rustc_span[4a89bdba9678f8e0]::def_id::LocalModDefId, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 0usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  44:     0x7f1768b2c69f - rustc_query_impl[60cfa4eef1128f6c]::query_impl::collect_mod_item_types::get_query_non_incr::__rust_end_short_backtrace
  45:     0x7f17681cfa52 - rustc_hir_analysis[1799a6ccb3095d3d]::check_crate
  46:     0x7f176898bd92 - rustc_interface[57a4cb1189ffa880]::passes::analysis
  47:     0x7f176898b9df - rustc_query_impl[60cfa4eef1128f6c]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[60cfa4eef1128f6c]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 1usize]>>
  48:     0x7f1768d24372 - rustc_query_system[30cc65df29d7d3a8]::query::plumbing::try_execute_query::<rustc_query_impl[60cfa4eef1128f6c]::DynamicConfig<rustc_query_system[30cc65df29d7d3a8]::query::caches::SingleCache<rustc_middle[9f94bb95ba4eb693]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[60cfa4eef1128f6c]::plumbing::QueryCtxt, false>
  49:     0x7f1768d240d5 - rustc_query_impl[60cfa4eef1128f6c]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
  50:     0x7f1768d3a582 - rustc_interface[57a4cb1189ffa880]::interface::run_compiler::<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}
  51:     0x7f1768dd2b46 - std[3acc11fb688f3d76]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_with_globals<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_pool_with_globals<rustc_interface[57a4cb1189ffa880]::interface::run_compiler<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>
  52:     0x7f1768dd2973 - <<std[3acc11fb688f3d76]::thread::Builder>::spawn_unchecked_<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_with_globals<rustc_interface[57a4cb1189ffa880]::util::run_in_thread_pool_with_globals<rustc_interface[57a4cb1189ffa880]::interface::run_compiler<core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>, rustc_driver_impl[a7481a600b2f11a0]::run_compiler::{closure#0}>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[8df037f8ced6ea1f]::result::Result<(), rustc_span[4a89bdba9678f8e0]::ErrorGuaranteed>>::{closure#1} as core[8df037f8ced6ea1f]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  53:     0x7f1763f97eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h61e4d902e063b23d
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2016:9
  54:     0x7f1763f97eb5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hfa3eaf4f75275f59
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/alloc/src/boxed.rs:2016:9
  55:     0x7f1763f97eb5 - std::sys::pal::unix::thread::Thread::new::thread_start::hb901d27f412b0ecd
                               at /rustc/6cc4843512d613f51ec81aba689180c31b0b28b6/library/std/src/sys/pal/unix/thread.rs:108:17
  56:     0x7f1763d819eb - <unknown>
  57:     0x7f1763e057cc - <unknown>
  58:                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 attach the file at `/tmp/im/rustc-ice-2024-02-11T17_08_31-2205227.txt` to your bug report

query stack during panic:
#0 [type_of] computing type of `accept::{constant#0}`
#1 [explicit_predicates_of] computing explicit predicates of `accept`
#2 [predicates_defined_on] computing predicates of `accept`
#3 [predicates_of] computing predicates of `accept`
#4 [collect_mod_item_types] collecting item types in top-level module
#5 [analysis] running analysis passes on this crate
end of query stack

@matthiaskrgr matthiaskrgr added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. C-bug Category: This is a bug. labels Feb 11, 2024
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 11, 2024
@matthiaskrgr
Copy link
Member Author

Regression in nightly-2023-07-29

commit[0] 2023-07-27: Auto merge of #114144 - workingjubilee:rollup-jkmtgdo, r=workingjubilee
commit[1] 2023-07-27: Auto merge of #108980 - Enselic:println-and-broken-pipe, r=workingjubilee
commit[2] 2023-07-28: Auto merge of #114115 - nnethercote:less-token-tree-cloning, r=petrochenkov
commit[3] 2023-07-28: Auto merge of #97571 - ehuss:symbol-mangling, r=michaelwoerister
commit[4] 2023-07-28: Auto merge of #112390 - MoskalykA:move-two-tests-from-library-to-tests, r=workingjubilee
commit[5] 2023-07-28: Auto merge of #114154 - calebcartwright:style-match-mac, r=joshtriplett
commit[6] 2023-07-28: Auto merge of #114134 - fee1-dead-contrib:rm-constness-from-param-env, r=oli-obk
commit[7] 2023-07-28: Auto merge of #113312 - Ddystopia:auto-trait-fun, r=lcnr
commit[8] 2023-07-28: Auto merge of #114119 - nnethercote:opt-TokenKind-clone, r=petrochenkov
commit[9] 2023-07-28: Auto merge of #111780 - weiznich:diagnostic_namespace, r=petrochenkov
commit[10] 2023-07-28: Auto merge of #113931 - cuviper:ci-ubuntu-22.04, r=Mark-Simulacrum
commit[11] 2023-07-28: Auto merge of #113522 - fmease:generic-consts, r=cjgillot
ERROR: no CI builds available between 500647f and 04abc37 within last 167 days

@matthiaskrgr matthiaskrgr removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Feb 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants