Compiler hangs during execution
Open
Nobody has claimed this yet.
A-coherence
A-trait-system
C-bug
fixed-by-next-solver
I-hang
P-medium
regression-from-stable-to-stable
S-has-bisection
S-has-mcve
T-compiler
T-types
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried this code:
trait Trait {}
struct W<T>(T);
impl<T, U> Trait for W<(<&Self as IntoIterator>, W<U>)>
where
W<T>: Trait,
W<U>: Trait,
{
}
fn impls<T: Trait>() {}
fn main() {
impls::<W<_>>();
}
I expected to see this happen:
The compilation process should complete successfully, and any errors in the code should be reported with diagnostic messages.
Instead, this happened:
The compiler hangs indefinitely and appears to never terminate.
Meta
rustc --version --verbose:
rustc 1.85.1 (4eb161250 2025-03-15)
binary: rustc
commit-hash: 4eb161250e340c8f48f66e2b929ef4a5bed7c181
commit-date: 2025-03-15
host: x86_64-pc-windows-msvc
release: 1.85.1
LLVM version: 19.1.7
Backtrace
error: expected `::`, found `,`
--> .\temp.rs:7:48
|
7 | impl<T, U> Trait for W<(<&Self as IntoIterator>, W<U>)>
| ^ expected `::`
error: expected `::`, found `,`
--> .\temp.rs:7:48
|
7 | impl<T, U> Trait for W<(<&Self as IntoIterator>, W<U>)>
| ^ expected `::`
|
help: expressions must be enclosed in braces to be used as const generic arguments
|
7 | impl<T, U> Trait for W<{ (<&Self as IntoIterator>, W<U>) }>
| + +
error[E0747]: constant provided when a type was expected
--> .\temp.rs:7:24
|
7 | impl<T, U> Trait for W<(<&Self as IntoIterator>, W<U>)>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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 compiling the minimal Rust reproducer with rustc 1.85.1 and confirm that compilation hangs instead of terminating. Investigate the compiler behavior around this input and verify that the process completes while reporting diagnostics for the invalid code.
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