endless loop instead of an overflow error, in the presence of multiple requirements that would overflow.
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
pub trait Foo {
type Bar<'a>;
type Baz<'a>;
}
impl Foo for ()
where
T: for<'a> Foo<
Bar<'a> = Self::Bar<'a>,
Baz<'a> = Self::Baz<'a>,
>
{}
I expected to see this happen:
An "overflow evaluating the requirement" error message should be reported. Probably it should generate:
error[E0275]: overflow evaluating the requirement `for<'a> <() as Foo>::Bar<'a> == _`
or
error[E0275]: overflow evaluating the requirement `for<'a> <() as Foo>::Baz<'a> == _`
Or perhaps another specific overflow error for the specific combined requirement it is evaluating.
Instead, this happened:
The compiler reached an endless loop.
Meta
rustc --version --verbose:
rustc 1.89.0-nightly (ce7e97f73 2025-05-11)
binary: rustc
commit-hash: ce7e97f7371af47e0786f74aa169f6ac9473ff4e
commit-date: 2025-05-11
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.4
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
Run the provided trait implementation reproducer with the reported nightly rustc version and confirm that evaluation loops instead of reporting overflow. Investigate the compiler's handling of the combined associated-type requirements; done means the reproducer terminates with a specific overflow diagnostic rather than an endless loop.
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