-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Program Hangs when Using Associated Types in Structs with Trait Bounds #115407
Copy link
Copy link
Closed
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-implied-boundsArea: Implied bounds / inferred outlives-boundsArea: Implied bounds / inferred outlives-boundsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-associated-itemsArea: Associated items (types, constants & functions)Area: Associated items (types, constants & functions)A-implied-boundsArea: Implied bounds / inferred outlives-boundsArea: Implied bounds / inferred outlives-boundsA-trait-systemArea: Trait systemArea: Trait systemC-bugCategory: This is a bug.Category: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I tried this code(reduced):
When attempting to compile the provided code, the program hangs indefinitely, resulting in a non-responsive state. This issue occurs when using associated types in structs with trait bounds.
😃I expected to see this happen: The code should compile successfully or produce a clear error message indicating the cause of the issue.
😥Instead, this happened: The compilation process hangs indefinitely, and the program does not execute.
Meta
rustc --version --verbose:We have attempted to use the
BACKTRACE=1command to obtain a backtrace for debugging purposes😢, but no output is generated. It is worth mentioning that the provided code snippet causes a hang issue on both the latest stable and nightly(nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.74.0-nightly (59a8294 2023-08-30)) versions of Rust.What‘s more,when we change
_var2: Box<St<'a, T::AssTrait>>to_var2: Box<St<'a, T>>, the program will produce the correct outputBacktrace