Skip to content

trait selection fails for projections under binders #102052

Open
@aliemjay

Description

@aliemjay

This fails to compile, but it shouldn't:

pub trait Trait {}

pub trait WithAssoc<'a> {
    type Assoc;
}

impl<T> Trait for for<'a> fn(T, <T as WithAssoc<'a>>::Assoc) where T: for<'a> WithAssoc<'a> {}

impl WithAssoc<'_> for u8 {
    type Assoc = u8;
}

fn main() {
    fn impls_trait<T: Trait>() {}
    impls_trait::<fn(u8, u8)>;
    //~^ ERROR the trait bound `fn(u8, u8): Trait` is not satisfied
}

@rustbot label C-bug T-types A-traits A-associated-items

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.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`.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions