Open
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>)>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Metadata
Metadata
Assignees
Labels
Area: CoherenceArea: Trait systemCategory: This is a bug.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Medium priorityStatus: a bisection has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.Performance or correctness regression from one stable version to another.