-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Associated type equality not followed through multiple traits #34257
Labels
A-type-system
Area: Type system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Comments
sgrif
added a commit
to diesel-rs/diesel
that referenced
this issue
Jun 13, 2016
There were two goals here: - Consistently put the constraint `AsQuery` on the output type. Many traits were using no bound or `Query` as the bound - Enforce that the SQL type can't change for DSLs which shouldn't change the output type (which is basically everything except select and joins) We shouldn't have to specify `SqlType=ST` in so many places, but we have to do it here to work around rust-lang/rust#34257. As part of this, I've also done the same cleanup of `LoadDsl` that we did to `FindDsl` in #352, moving as many where clause constraints as possible off of the trait definition and into the impl. This let us implement `first` purely in terms of `limit` and methods from `LoadDsl`, with a more reasonable where clause on that method. `first` was the only place that referenced `LimitDsl` generically in our code base, and was the original motivation for this change.
sgrif
added a commit
to diesel-rs/diesel
that referenced
this issue
Jun 13, 2016
There were two goals here: - Consistently put the constraint `AsQuery` on the output type. Many traits were using no bound or `Query` as the bound - Enforce that the SQL type can't change for DSLs which shouldn't change the output type (which is basically everything except select and joins) We shouldn't have to specify `SqlType=ST` in so many places, but we have to do it here to work around rust-lang/rust#34257. As part of this, I've also done the same cleanup of `LoadDsl` that we did to `FindDsl` in #352, moving as many where clause constraints as possible off of the trait definition and into the impl. This let us implement `first` purely in terms of `limit` and methods from `LoadDsl`, with a more reasonable where clause on that method. `first` was the only place that referenced `LimitDsl` generically in our code base, and was the original motivation for this change.
I believe that this may have the same cause as #25409 (the "This can be worked around by manually restating the constraint" sounds familiar at least), event though the issue manifests itself in a different way here. |
Triage; still reproduces |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-type-system
Area: Type system
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Simplest case to reproduce would be to add a trait which decorates
IntoIterator
and try to write a blanket impl for that trait:Will fail to compile with
even though every trait mentioned has the constraint that the output has
Iterator<Item=Self::Item>
.Ran into this with a more concrete use case inside of Diesel:
This can be worked around by manually restating the constraint, like so:
but this shouldn't be required.
The text was updated successfully, but these errors were encountered: