Overflow evaluating the requirement on `associated_type_defaults` bounded on the field it's being assigned
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
#![feature(associated_type_defaults)]
trait Trait {
type A;
}
trait Other<T>
where
T: Trait<A = Self::A>,
{
type A = T::A;
}
See playground.
I expected the associated type default to compile since the bound is valid when implementing the trait. In my mind type A = T::A should be compatible with the T: Trait<A = Self::A> constraint;
Instead, this happened:
error[E0275]: overflow evaluating the requirement `<Self as UnsizedVisitor<T>>::A == _`
--> src/lib.rs:12:14
|
12 | type A = T::A;
| ^^^^
Meta
rustc --version --verbose:
binary: rustc
commit-hash: 794c12416b2138064af1f2746646973fafd9419d
commit-date: 2025-02-21
host: x86_64-pc-windows-msvc
release: 1.87.0-nightly
LLVM version: 20.1.0
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 by reproducing the overflow from the example in src/lib.rs at line 12 or through the linked Rust Playground, using the reported nightly version. Investigate how rustc evaluates the associated_type_defaults bound and determine what behavior should replace the recursive requirement; done means the example is handled without an overflow and the behavior is covered by an appropriate compiler test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100