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 in adt_const_params: panicked at 'const parameter types cannot be generic' #108952

Closed
asquared31415 opened this issue Mar 9, 2023 · 5 comments
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. E-needs-test 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)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@asquared31415
Copy link
Contributor

Code

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

struct LifetimeGeneric<'a>(&'a ());

struct UwU<'b, const T: LifetimeGeneric>(&'b ());

playground

LifetimeGeneric and UwU need to be generic over a lifetime specifically, removing either lifetime does not ICE.

Meta

rustc --version --verbose:

rustc 1.70.0-nightly (900c35403 2023-03-08)
binary: rustc
commit-hash: 900c3540378c8422b8087ffa3db60fa6c8abfcad
commit-date: 2023-03-08
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7
Backtrace

error[[E0106]](https://doc.rust-lang.org/nightly/error_codes/E0106.html): missing lifetime specifier
 --> src/lib.rs:6:25
  |
6 | struct UwU<'b, const T: LifetimeGeneric>(&'b ());
  |                         ^^^^^^^^^^^^^^^ expected named lifetime parameter
  |
help: consider using the `'b` lifetime
  |
6 | struct UwU<'b, const T: LifetimeGeneric<'b>>(&'b ());
  |                                        ++++

thread 'rustc' panicked at 'const parameter types cannot be generic', compiler/rustc_middle/src/ty/context.rs:2029:26
stack backtrace:
   0:     0x7fcb6e18353a - std::backtrace_rs::backtrace::libunwind::trace::h5499f6e9ee8d39f8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x7fcb6e18353a - std::backtrace_rs::backtrace::trace_unsynchronized::h7278d8915e5a8a4f
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fcb6e18353a - std::sys_common::backtrace::_print_fmt::h0c7e844ccbe54001
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:65:5
   3:     0x7fcb6e18353a - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h76f2d4fdd5e6ad12
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x7fcb6e1e6cee - core::fmt::write::h1775f2c88ef0e3b9
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/fmt/mod.rs:1232:17
   5:     0x7fcb6e1764e5 - std::io::Write::write_fmt::hfa496b0ed0f58ff3
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/io/mod.rs:1684:15
   6:     0x7fcb6e183305 - std::sys_common::backtrace::_print::h995e9f70ef8cb7a5
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:47:5
   7:     0x7fcb6e183305 - std::sys_common::backtrace::print::he938621c452cca4c
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:34:9
   8:     0x7fcb6e18607f - std::panicking::default_hook::{{closure}}::h54a42fdbf61bd63c
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:271:22
   9:     0x7fcb6e185dbb - std::panicking::default_hook::h237f087925386eb9
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:290:9
  10:     0x7fcb714756c5 - <rustc_driver_impl[37bd08e570b8de33]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[9f74edcc8a2533f5]::ops::function::FnOnce<(&core[9f74edcc8a2533f5]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fcb6e1868bd - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h86b8a5cdb22895d8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:2001:9
  12:     0x7fcb6e1868bd - std::panicking::rust_panic_with_hook::h3b3e70d6d2eb55f8
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:696:13
  13:     0x7fcb6e186639 - std::panicking::begin_panic_handler::{{closure}}::hdb26ba8feb23c2d0
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:583:13
  14:     0x7fcb6e1839a6 - std::sys_common::backtrace::__rust_end_short_backtrace::heb4e04cb16e3e639
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys_common/backtrace.rs:150:18
  15:     0x7fcb6e186342 - rust_begin_unwind
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/panicking.rs:579:5
  16:     0x7fcb6e1e3043 - core::panicking::panic_fmt::h1aa26efd95b582e6
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/panicking.rs:64:14
  17:     0x7fcb6e1e31b1 - core::panicking::panic_display::h8b07ac88322081f4
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/panicking.rs:147:5
  18:     0x7fcb6e1e315b - core::panicking::panic_str::h834cb14285912af4
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/panicking.rs:131:5
  19:     0x7fcb6e1e2dc6 - core::option::expect_failed::hf9b4e924d89d67b9
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/core/src/option.rs:2045:5
  20:     0x7fcb6fcad83d - <rustc_middle[d952a4eb3363976b]::ty::list::List<rustc_middle[d952a4eb3363976b]::ty::subst::GenericArg>>::fill_item::<<rustc_middle[d952a4eb3363976b]::ty::list::List<rustc_middle[d952a4eb3363976b]::ty::subst::GenericArg>>::identity_for_item::{closure#0}>
  21:     0x7fcb6fcac362 - <rustc_middle[d952a4eb3363976b]::ty::list::List<rustc_middle[d952a4eb3363976b]::ty::subst::GenericArg>>::identity_for_item
  22:     0x7fcb7098c871 - rustc_hir_analysis[db450ef6184d9cb6]::collect::type_of::type_of
  23:     0x7fcb6fe82d80 - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::type_of, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  24:     0x7fcb6fe8170c - <rustc_query_impl[d542d75c076a29bb]::Queries as rustc_middle[d952a4eb3363976b]::ty::query::QueryEngine>::type_of
  25:     0x7fcb6fcf94c6 - <rustc_hir_analysis[db450ef6184d9cb6]::collect::CollectItemTypesVisitor as rustc_hir[829d2a01d5dbcc01]::intravisit::Visitor>::visit_item
  26:     0x7fcb6fcf7b86 - <rustc_middle[d952a4eb3363976b]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[db450ef6184d9cb6]::collect::CollectItemTypesVisitor>
  27:     0x7fcb6fcf7a9c - rustc_hir_analysis[db450ef6184d9cb6]::collect::collect_mod_item_types
  28:     0x7fcb70ae0c05 - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::collect_mod_item_types, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  29:     0x7fcb70ae079a - <rustc_query_impl[d542d75c076a29bb]::Queries as rustc_middle[d952a4eb3363976b]::ty::query::QueryEngine>::collect_mod_item_types
  30:     0x7fcb6f8ee7ef - <rustc_middle[d952a4eb3363976b]::hir::map::Map>::for_each_module::<rustc_hir_analysis[db450ef6184d9cb6]::check_crate::{closure#0}::{closure#0}::{closure#0}>
  31:     0x7fcb6f8ee3d8 - <rustc_session[ba04d21bdf852ac2]::session::Session>::track_errors::<rustc_hir_analysis[db450ef6184d9cb6]::check_crate::{closure#0}, ()>
  32:     0x7fcb6f8eb8f2 - rustc_hir_analysis[db450ef6184d9cb6]::check_crate
  33:     0x7fcb6f8e18e2 - rustc_interface[b840461aee9fca96]::passes::analysis
  34:     0x7fcb70c9d45d - rustc_query_system[bc9882aaabdaeb26]::query::plumbing::try_execute_query::<rustc_query_impl[d542d75c076a29bb]::queries::analysis, rustc_query_impl[d542d75c076a29bb]::plumbing::QueryCtxt>
  35:     0x7fcb70c9d15f - <rustc_query_impl[d542d75c076a29bb]::Queries as rustc_middle[d952a4eb3363976b]::ty::query::QueryEngine>::analysis
  36:     0x7fcb70adb0d6 - <rustc_middle[d952a4eb3363976b]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}::{closure#2}::{closure#4}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>
  37:     0x7fcb706cb858 - rustc_span[312e5fbb5d1460ce]::with_source_map::<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
  38:     0x7fcb706c2fec - std[76763ff83cd4f414]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b840461aee9fca96]::util::run_in_thread_pool_with_globals<rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>
  39:     0x7fcb706c2a1a - <<std[76763ff83cd4f414]::thread::Builder>::spawn_unchecked_<rustc_interface[b840461aee9fca96]::util::run_in_thread_pool_with_globals<rustc_interface[b840461aee9fca96]::interface::run_compiler<core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>, rustc_driver_impl[37bd08e570b8de33]::run_compiler::{closure#1}>::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[9f74edcc8a2533f5]::result::Result<(), rustc_span[312e5fbb5d1460ce]::ErrorGuaranteed>>::{closure#1} as core[9f74edcc8a2533f5]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  40:     0x7fcb6e1907b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2d50a0adfdb2874f
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:1987:9
  41:     0x7fcb6e1907b3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h7afed2ea646a4458
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/alloc/src/boxed.rs:1987:9
  42:     0x7fcb6e1907b3 - std::sys::unix::thread::Thread::new::thread_start::h950100cbea36de7e
                               at /rustc/900c3540378c8422b8087ffa3db60fa6c8abfcad/library/std/src/sys/unix/thread.rs:108:17
  43:     0x7fcb6e055609 - start_thread
  44:     0x7fcb6df78133 - clone
  45:                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: rustc 1.70.0-nightly (900c35403 2023-03-08) 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:
#0 [type_of] computing type of `UwU`
#1 [collect_mod_item_types] collecting item types in top-level module
#2 [analysis] running analysis passes on this crate
end of query stack
For more information about this error, try `rustc --explain E0106`.
error: could not compile `playground` (lib) due to previous error

@asquared31415 asquared31415 added 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. labels Mar 9, 2023
@BoxyUwU BoxyUwU added A-const-generics Area: const generics (parameters and arguments) F-adt_const_params `#![feature(adt_const_params)]` labels Mar 9, 2023
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Mar 15, 2023
@langston-barrett
Copy link

@rustbot label +S-bug-has-mcve

@rustbot rustbot added the S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue label Mar 18, 2023
@langston-barrett
Copy link

Triaged with Icemelter. Steps performed:

  • Reproduced: ✅
  • Formatted: ✅ No change, already formatted
  • Reduced: ❌
  • Bisected: ✅

Regression in nightly-2023-02-18

searched nightlies: from nightly-2023-02-17 to nightly-2023-03-18
regressed nightly: nightly-2023-02-18
searched commit range: 9a7cc6c...9aa5c24
regressed commit: 9556b56

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc /tmp/bisect-jga8wm.sh --preserve 
Details

rustc version:

rustc 1.70.0-nightly (13afbdaa0 2023-03-17)
binary: rustc
commit-hash: 13afbdaa0655dda23d7129e59ac48f1ec88b2084
commit-date: 2023-03-17
host: x86_64-unknown-linux-gnu
release: 1.70.0-nightly
LLVM version: 15.0.7

Icemelter version: v0.2.0

Icemelter command line:

'icemelter' '--markdown' '--bisect' 'ice.rs' '--' 'rustc' '+nightly'

@rustbot label +S-bug-has-mcve

Do you have feedback about this report? Please file an issue!

@JohnTitor
Copy link
Member

Fixed on the latest nightly, marking as E-needs-test (or, feel free to close if we have a sufficient regression test)
@rustbot labels: +E-needs-test

@rustbot rustbot added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 15, 2023
@jruderman
Copy link
Contributor

Fixed in nightly-2023-08-10 with rollup 19a647d. I'm guessing #114606 fixed this.

@JohnTitor
Copy link
Member

Thank you for bisecting! The regression test there should cover this issue's case, closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-const-generics Area: const generics (parameters and arguments) C-bug Category: This is a bug. E-needs-test 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)]` glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue 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

7 participants