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

Unexpected unsatisfied trait bound #115697

Open
benluelo opened this issue Sep 9, 2023 · 2 comments
Open

Unexpected unsatisfied trait bound #115697

benluelo opened this issue Sep 9, 2023 · 2 comments
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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@benluelo
Copy link
Contributor

benluelo commented Sep 9, 2023

I tried this code:

https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=761c1cce2cdf196f23ef8eab2a59bf6d

There seems to be an issue when resolving a blanket impl through the GAT when an associated type of the T is used - the above code is as far as I could minimize it while keeping the error message the same.

Interesting to note is this line in the error:

help: the trait Unsatisfied<()> is implemented for GenericStruct<T>

Which is true(!) but the error states that:

the trait Unsatisfied<<GenericStruct<<Counterparty as HasAssoc>::Assoc> as Proto>::Proto> is not implemented for GenericStruct<<Counterparty as HasAssoc>::Assoc>

Which leads me to believe this is similar to #41756 or #24066? But I'm not sure honestly.

EDIT: I refactored the original (non-minimized) code to not use GATS and encountered this: #89910; perhaps the original issue is related?

@benluelo benluelo added the C-bug Category: This is a bug. label Sep 9, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Sep 9, 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 Sep 19, 2023
@fmease
Copy link
Member

fmease commented Sep 19, 2023

(fixed by next solver: fail → pass)

@benluelo
Copy link
Contributor Author

Another example, not sure if it's just a smaller example than the one I posted previously but it's also fixed by trait-solver=next: godbolt

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-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants