-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
defining type-alias-impl-trait inside closures is broken #105498
Comments
is the correct fix here to propagate member constraints to the function and only check them there? |
Member constraints are more complicated than regular outlives constraints in that they require the complete constraint graph between the "source" and "choice" regions in order to pick the right choice. When one of the regions is "external" to the closure we get surprising results like in this issue. I believe this is impossible to fix unless we borrow check the closure and the parent fn in a single context like we did with the good old HIR borrowck, but that in turn is complicated. This is why I don't bother and suggest to disallow such defining uses. See #116891 (comment) for details. |
All these test cases should pass:
The current algorithm for member constraints is broken when used in closures because it assumes the relations between universal regions to be known, which is not true when we're borrow-checking closures.
@rustbot label C-bug T-types F-type_alias_impl_trait A-borrow-checker
The text was updated successfully, but these errors were encountered: