Skip to content

In Impl Trait for T with associated type that = T, bounds do not recognize that T impls Trait #92505

Open
@thorjelly

Description

This compiles and runs: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=0b6a35cad2587fe5d1d4cdb30e94aa47

However this doesn't: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=4e6a1dc742260b4754b540349099fcb3

The first bound seems to be "forgotten" when the second bound is added. A few folks on the rust discord suggested this may be a bug. It appears to be the case in both nightly and stable.

It appears to be the case even without const generics: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=1a12aaeb3addf903f722337a576747b3

Stable version: 1.57.0
Nightly version: 1.59.0-nightly (2022-01-01 c145692)

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-trait-objectsArea: trait objects, vtable layoutC-bugCategory: This is a bug.S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.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