Skip to content

Compiler hangs during execution #139197

@jjl9807

Description

@jjl9807

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

No one assigned

    Labels

    A-coherenceArea: CoherenceA-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.P-mediumMedium priorityS-has-bisectionStatus: A bisection has been found for this issueS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.fixed-by-next-solverFixed by the next-generation trait solver, `-Znext-solver`.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions