Skip to content

Specifying associated type requires redundant constraints #39532

Closed
@sgrif

Description

@sgrif

Reproduction script

Expected behavior: The file compiles successfully
Actual behavior: The function x requires an additional <T as Foo>::Baz: Bar<U>. This check is entirely redundant with the trait definition, and would always have to be true for T: Foo<Bar=U> to hold.

This only occurs if the constraint referencing the first associated type is a parameter to the trait, not an associated type, which is why this doesn't happen for IntoIterator. This appears to have been an unintended side effect of RFC 1214

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions