Infinite loop in compiler
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
Minimal example code which causes infinite compile times:
trait Bound { type Assoc; }
struct Recursive<'a, A: Bound> {
value: A,
rest: &'a Option<Recursive<'a, A::Assoc>>
}
I expected to see: the compiler finish executing.
Instead, this happened: the compiler hangs with modest CPU usage, seemingly indefinitely.
As an aside, the lack of a bound on the Assoc type should raise an error (otherwise the declaration is self-contradictory), but we never even get that far. So I have removed the bound in favor of making the example as minimal as possible. To be clear, the version with the correct bound hangs as well.
Meta
I have not done a thorough search over which versions hang.
The bug exists in stable: 1.73.0, 1.74.0, and possibly more versions of stable compiler.
The bug exists in beta 1.75.0-beta.3, and nightly 1.76.0-nightly, and possibly more versions of these compilers.
rustc --version --verbose:
rustc 1.73.0 (cc66ad468 2023-10-03)
binary: rustc
commit-hash: cc66ad468955717ab92600c770da8c1601a4ff33
commit-date: 2023-10-03
host: aarch64-apple-darwin
release: 1.73.0
LLVM version: 17.0.2
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 minimal Rust example from the linked Rust Playground and compare its behavior across the stable, beta, and nightly versions listed. Trace which compiler stage fails to terminate; done means the example no longer hangs and reaches the expected compiler diagnostic.
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