-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cycle detected when using associated type bounds in super trait #65913
Comments
When we write: trait B: A<T: B> {} this is equivalent to: trait B
where
Self: A<T: B>
{} which is equivalent to: trait B
where
Self: A,
<Self as A>::T: B,
{} This results in an error: error[E0277]: the trait bound `<<Self as A>::T as A>::T: B` is not satisfied One might think that this should compile because What is curious here is that rather than getting the error message about "not satisfied", we are getting a cycle error. cc @alexreg @nikomatsakis @tmandry |
I wonder if the supertraits query is including the associated type bound - AFAIK it should only include the bounds specified on |
@eddyb I know that was a problem previously, though I introduced a filter in relevant places to combat it. We may need to introduce a filter in another place. |
This issues still happens, are there any updates on fixes? |
As of #110512, this is no longer a cycle error, and the code above errors with:
The fact that this still errors is a somewhat unfortunate side-effect of #65913 (comment), since the Fixing this in a way that doesn't cause the compiler to overflow generating an infinite nested set of |
This now hangs on nightly (not only the sugared form but also the desugared one) with both the old and the new solver. @rustbot label I-hang E-needs-bisection |
Regressed in #112629 (git-revert: hang → errors). CC @compiler-errors |
Prevent cycle in implied predicates computation Makes rust-lang#65913 from hang -> fail. I believe fail is the correct state for this test to remain for the long term.
Rollup merge of rust-lang#121409 - compiler-errors:atb-cycle, r=cjgillot Prevent cycle in implied predicates computation Makes rust-lang#65913 from hang -> fail. I believe fail is the correct state for this test to remain for the long term.
I don't believe this will ever be made to compile. A cycle error IMO is the correct state for this. Diagnostics could perhaps be improved, but they would need to explain some details about how supertrait bound elaboration works. |
I don't know if this is a bug or expected behaviour. But I'm encountering the following error when compiling the following code.
But if I merge the traits
A
andB
into the traitC
it works.I think the first example should work as good as the second since the trait
C
is only split into two traitsA
andB
with same functionality.The text was updated successfully, but these errors were encountered: