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 bounds of associated types in where clauses result in unsatisfied requeriments #116749

Closed
c410-f3r opened this issue Oct 14, 2023 · 3 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) A-lazy-normalization Area: Lazy normalization (tracking issue: #60471) 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@c410-f3r
Copy link
Contributor

c410-f3r commented Oct 14, 2023

Feel free to close if duplicated.

pub trait Foo<TY> {
    type FooAssociatedTy;
}

pub trait Bar {
    type BarAssociatedTy;
    
    fn send<T>()
    where
        T: Foo<Self::BarAssociatedTy>,
        T::FooAssociatedTy: Send;
}

impl Bar for () {
    type BarAssociatedTy = ();

    fn send<T>()
    where
        T: Foo<()>,
        T::FooAssociatedTy: Send,
    {
    }
}

Taking aside the errors, a diagnostic suggests adding a weird T: Foo<()> + Foo<()> bound.

Things that will make everything compile:

@c410-f3r c410-f3r added the C-bug Category: This is a bug. label Oct 14, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Oct 14, 2023
@c410-f3r c410-f3r changed the title Weird bug involving associated types and where bounds Trait bounds of associated types in where bounds results in unsatisfied requeriments Oct 17, 2023
@c410-f3r c410-f3r changed the title Trait bounds of associated types in where bounds results in unsatisfied requeriments Trait bounds of associated types in where clauses result in unsatisfied requeriments Oct 17, 2023
@fmease fmease added A-trait-system Area: Trait system A-associated-items Area: Associated items (types, constants & functions) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. fixed-by-next-solver Fixed by the next-generation trait solver, `-Znext-solver`. and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Oct 19, 2023
@fmease
Copy link
Member

fmease commented Oct 19, 2023

Fixed in the next solver (-Ztrait-solver=next).
Very similar to #41118, #108933 and #116377.

@c410-f3r
Copy link
Contributor Author

Thanks! :)

@lcnr lcnr added the A-lazy-normalization Area: Lazy normalization (tracking issue: #60471) label Nov 13, 2023
@lcnr
Copy link
Contributor

lcnr commented Nov 13, 2023

closing as dup of #41118, see the explanation in #41118 (comment)

@lcnr lcnr closed this as completed Nov 13, 2023
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-lazy-normalization Area: Lazy normalization (tracking issue: #60471) 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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants