suggestion to add bound that already exists when using `generic_const_exprs`
Open
Nobody has claimed this yet.
A-diagnostics
F-generic_const_exprs
P-low
T-compiler
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.2k
- PR merge metrics
- PR metrics pending
Description
Code
use super::vertex::Vertex;
pub struct Simplex<const N: usize>
where
[(); N - 1]:
{
pub vertices: [Vertex<N>; N]
}
impl<const N: usize> Simplex<N>
where
[(); N - 1]:
{
fn child_simplicies(&self) -> [Simplex<{N - 1}>; N - 1]
where
[(); N - 1]:
{
todo!()
}
}
Current output
error: unconstrained generic constant
--> src\mesh\simplex.rs:14:35
|
14 | fn child_simplicies(&self) -> [Simplex<{N - 1}>; N - 1]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: required by a bound in `Simplex`
--> src\mesh\simplex.rs:5:10
|
3 | pub struct Simplex<const N: usize>
| ------- required by a bound in this struct
4 | where
5 | [(); N - 1]:
| ^^^^^ required by this bound in `Simplex`
help: try adding a `where` bound
|
16 | [(); N - 1]:, [(); N - 1]:
| ++++++++++++++
Desired output
Rationale and extra context
No response
Other cases
Rust Version
rustc 1.95.0-nightly (57d2fb136 2026-02-01)
binary: rustc
commit-hash: 57d2fb136650d05efb3ed3ea33b330bfc85844d5
commit-date: 2026-02-01
host: x86_64-pc-windows-msvc
release: 1.95.0-nightly
LLVM version: 22.1.0
Anything else?
No response
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
Reproduce the diagnostic from the Rust snippet with the reported nightly compiler and inspect the compiler's generic-const-expression bound checking and diagnostic entry points. Determine why the existing [(); N - 1]: bound is not recognized for the return type, then verify that the redundant-bound suggestion is no longer emitted.
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
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100