Tracking Issue for Rustc Public: Expose Type and Const Parameter Constraints
@nanjekyejoannah is already working on this.
Since Sep 10, 2026.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
This is a tracking issue for Rustc public API.
Feature gate: #![feature(rustc_public_generic_clauses)]
Problem
Currently, the APIs in Rustc public missing some information required for building full fidelity tools on top of it.
(1) Trait bounds:
trait Step {}
fn advance<T: Step>(value: T) -> T {
value
}
Rustc Public exposes that advance has a type parameter named T, but not the constraint T: Step.
(2) Const types:
fn f<const N: usize>()
Rustc Public reveals that N is a const generic but not its type.
Public API
The FnDef type could be extended by two new functions:
impl FnDef {
pub fn generics_of(&self) -> Generics;
pub fn clauses_of(&self) -> GenericClauses;
pub fn explicit_clauses_of(&self) -> GenericClauses;
}
Alternatively, the trait bound info could be included in Generics
For the const c: usize problem, GenericParamDefKind would be extended for the Const variant to also carry a type.
Steps / History
- ACP: rust-lang/libs-team#...
- Implementation: #...
- Final comment period (FCP)^1
- Stabilization PR
Unresolved Questions
This seems to be a simple API extension, so no open questions.
- None yet.
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.
Assessment
This issue has not been assessed yet.