E0053: const parameters under generic_const_parameter_types rejected when identical
Author: HaineSenseiCreated Sep 17, 2026Updated Sep 17, 2026
LabelsC-bugF-adt_const_paramsF-generic_const_parameter_typesneeds-triage
While working on a const generic shaped grid, I tried code that minimised to this:
#![feature(min_adt_const_params)]
#![feature(generic_const_parameter_types)]
#![allow(incomplete_features)]
trait Trait {
fn method<const A: usize, const B: [usize; A]>();
}
struct Foo;
impl Trait for Foo {
fn method<const A: usize, const B: [usize; A]>() {}
}
I expected this to effectively implement the trait for Foo, but instead, it complained that the impl's const parameter of type [usize; A] did not match the trait's const parameter [usize; A]:
error[E0053]: associated function `method` has an incompatible generic parameter for trait `Trait`
--> minimal.rs:12:31
|
5 | trait Trait {
| -----
6 | fn method<const A: usize, const B: [usize; A]>();
| ------------------- expected const parameter of type `[usize; A]`
...
11 | impl Trait for Foo {
| ------------------
12 | fn method<const A: usize, const B: [usize; A]>() {}
| ^^^^^^^^^^^^^^^^^^^ found const parameter of type `[usize; A]`
I initially asked in Zulip about this in this topic where it was confirmed the issue probably lies at this line where the != is not the appropriate comparison under min_adt_const_params:
https://github.com/rust-lang/rust/blob/4b6d04e706108ccfeafe2547fbe857dfe8972bad/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs#L2084-L2086
Meta
rustc --version --verbose:
rustc 1.100.0-nightly (4b6d04e70 2026-09-13)
binary: rustc
commit-hash: 4b6d04e706108ccfeafe2547fbe857dfe8972bad
commit-date: 2026-09-13
host: x86_64-unknown-linux-gnu
release: 1.100.0-nightly
LLVM version: 23.1.1
@rustbot label +F-min_adt_const_params +F-generic_const_parameter_types
Source: rust-lang/rust