Open
Description
opened on Mar 13, 2024
I tried the code:
trait Access {
type Downcast: Access;
}
trait Mapping<X: Access> {}
trait AllowedMappingLoopback<X: Access> {
type Chain: AllowedMapping<X::Downcast>;
}
impl<X: Access> AllowedMappingLoopback<X> for X
where
X: AllowedMapping<X::Downcast>,
{
type Chain = X;
}
trait AllowedMapping<X: Access>: AllowedMappingLoopback<X, Chain = Self> {}
impl<X: Access, T> AllowedMapping<X> for T where
T: Mapping<X> + AllowedMappingLoopback<X, Chain = Self>
{
}
fn do_thing_with_allowed<X: Access>(mapping: impl AllowedMapping<X>) {}
struct BasicMapping;
fn test() {
do_thing_with_allowed(BasicMapping);
}
This results in an infinite loop within the compiler, within both the latest nightly (1.78.0 (2024-03-12)) and stable (1.76.0).
(see playground)
Metadata
Assignees
Labels
Area: Associated items (types, constants & functions)Area: Trait systemCategory: This is a bug.Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.Relevant to the types team, which will review and decide on the PR/issue.Fixed by the next-generation trait solver, `-Znext-solver`.
Activity