E0053: const parameters under generic_const_parameter_types rejected when identical
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with compiler/rustc_hir_analysis/src/check/compare_impl_item.rs around lines 2084-2086, where the issue identifies the incompatible comparison. Reproduce the report with the minimized const-generic example and inspect how the comparison behaves under min_adt_const_params. Done means the identical trait and impl parameters are accepted without E0053.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100