Compiler hangs during execution · Issue #139197 · rust-lang/rust (original) (raw)
I tried this code:
trait Trait {}
struct W(T);
impl<T, U> Trait for W<(<&Self as IntoIterator>, W)> where W: Trait, W: 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>)>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^