Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trait selection fails for projections under binders #102052

Open
aliemjay opened this issue Sep 20, 2022 · 1 comment
Open

trait selection fails for projections under binders #102052

aliemjay opened this issue Sep 20, 2022 · 1 comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. T-types Relevant to the types team, which will review and decide on the PR/issue.

Comments

@aliemjay
Copy link
Member

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

@rustbot rustbot added A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system C-bug Category: This is a bug. T-types Relevant to the types team, which will review and decide on the PR/issue. labels Sep 20, 2022
@lcnr
Copy link
Contributor

lcnr commented Sep 20, 2022

with this fixed without coherence being fixed we should increase the severity of #102048 as it then becomes exploitable

@lcnr lcnr added the fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. label Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system C-bug Category: This is a bug. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. T-types Relevant to the types team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants