Skip to content

ICE: rustdoc: const parameter types cannot be generic #149288

@matthiaskrgr

Description

@matthiaskrgr

Code

//@ check-pass

#![feature(adt_const_params, generic_const_parameter_types)]
#![expect(incomplete_features)]

struct Bar<const N: usize, const M: [u8; N]>;

fn foo<const N: usize, const M: [u8; N]>(_: Bar<N, M>) {}

fn main() {
    foo(Bar::<2, { [1; 2] }>);
    foo::<_, _>(Bar::<2, { [1; 2] }>);
}

Meta

rustc --version --verbose:

rustc 1.93.0-nightly (c23ed3ef2 2025-11-23)
binary: rustc
commit-hash: c23ed3ef28b3cc30658310f771ddc66e5b687cf4
commit-date: 2025-11-23
host: x86_64-unknown-linux-gnu
release: 1.93.0-nightly
LLVM version: 21.1.5

Error output


Backtrace

thread 'rustc' (340617) panicked at src/librustdoc/clean/mod.rs:568:30:
const parameter types cannot be generic
stack backtrace:
   0:     0x7fa01288d0c3 - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::hf60079e6fb6edce2
   1:     0x7fa0130119c8 - core::fmt::write::h4556407225efd72f
   2:     0x7fa012842bf6 - std::io::Write::write_fmt::h0ea3249f5299861b
   3:     0x7fa012859dac - std::panicking::default_hook::{{closure}}::hdc04698b81fca7ef
   4:     0x7fa012859903 - std::panicking::default_hook::h4ae2716da9aa0620
   5:     0x7fa0118de537 - std[ad4fd56af8a863a2]::panicking::update_hook::<alloc[689149252bbc5bc7]::boxed::Box<rustc_driver_impl[48d5ebda47e4f6c2]::install_ice_hook::{closure#1}>>::{closure#0}
   6:     0x7fa01285a162 - std::panicking::panic_with_hook::h32ebcbf876d2754f
   7:     0x7fa012859ef8 - std::panicking::panic_handler::{{closure}}::h89279fddaaeed151
   8:     0x7fa012853f29 - std::sys::backtrace::__rust_end_short_backtrace::h1231c0eb8ad20f44
   9:     0x7fa01283521d - __rustc[d04359ab18481e3f]::rust_begin_unwind
  10:     0x7fa00fa62bdc - core::panicking::panic_fmt::h5575cb3abe0bc1c9
  11:     0x7fa01030ff04 - core::option::expect_failed::h1de366dd09067eae
  12:     0x5595583b1cd2 - rustdoc[6004462a24d6e2c7]::clean::clean_generic_param_def
  13:     0x5595583e04b2 - rustdoc[6004462a24d6e2c7]::clean::auto_trait::clean_param_env
  14:     0x5595580e21d5 - <rustc_trait_selection[9292ab8ee199358]::traits::auto_trait::AutoTraitFinder>::find_auto_trait_generics::<rustdoc[6004462a24d6e2c7]::clean::types::Generics, rustdoc[6004462a24d6e2c7]::clean::auto_trait::synthesize_auto_trait_impl::{closure#0}>
  15:     0x5595583e5323 - rustdoc[6004462a24d6e2c7]::clean::auto_trait::synthesize_auto_trait_impl
  16:     0x5595583ebee0 - rustdoc[6004462a24d6e2c7]::clean::utils::synthesize_auto_trait_and_blanket_impls
  17:     0x55955843d4ec - <rustdoc[6004462a24d6e2c7]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[6004462a24d6e2c7]::visit::DocVisitor>::visit_item
  18:     0x55955843d3e9 - <rustdoc[6004462a24d6e2c7]::passes::collect_trait_impls::SyntheticImplCollector as rustdoc[6004462a24d6e2c7]::visit::DocVisitor>::visit_item
  19:     0x5595583f9674 - rustdoc[6004462a24d6e2c7]::passes::collect_trait_impls::collect_trait_impls
  20:     0x55955839e952 - rustdoc[6004462a24d6e2c7]::core::run_global_ctxt
  21:     0x559558292210 - rustdoc[6004462a24d6e2c7]::main_args::{closure#2}::{closure#0}
  22:     0x55955828974b - rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler::<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}
  23:     0x5595581da3b8 - std[ad4fd56af8a863a2]::sys::backtrace::__rust_begin_short_backtrace::<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_with_globals<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_pool_with_globals<rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>
  24:     0x5595582b81bd - <<std[ad4fd56af8a863a2]::thread::Builder>::spawn_unchecked_<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_with_globals<rustc_interface[b4fbb2cc6bda294c]::util::run_in_thread_pool_with_globals<rustc_interface[b4fbb2cc6bda294c]::interface::run_compiler<(), rustdoc[6004462a24d6e2c7]::main_args::{closure#2}>::{closure#1}, ()>::{closure#0}, ()>::{closure#0}::{closure#0}, ()>::{closure#1} as core[b965173db0298ed8]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  25:     0x7fa01411e46f - std::sys::thread::unix::Thread::new::thread_start::hacdf6d1111221eb3
  26:     0x7fa00da969cb - <unknown>
  27:     0x7fa00db1aa0c - <unknown>
  28:                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-rustdoc&template=ice.md

note: please make sure that you have updated to the latest nightly

note: please attach the file at `/tmp/im/rustc-ice-2025-11-24T20_24_35-340566.txt` to your bug report

query stack during panic:
end of query stack

Metadata

Metadata

Labels

C-bugCategory: This is a bug.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.F-adt_const_params`#![feature(adt_const_params)]`F-generic_const_parameter_types`#![feature(generic_const_parameter_types)]`I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️S-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions