-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Mysterious "higher-ranked lifetime error" with async fn in trait and return-type notation #110963
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
Comments
Actually I forgot to click submit on this issue and I think I solved it in the mean time... edit: didnt actually solve it completely, it still exists for early-bound lifetimes |
… r=cjgillot Don't duplicate anonymous lifetimes for async fn in traits `record_lifetime_params_for_async` needs to be called outside of the scope of the function, or else it'll end up collecting anonymous lifetimes twice (those on the function and those within the `AnonymousCreateParameter` rib). This matches how `record_lifetime_params_for_async` is being used for functions with bodies below. This fixes (partially) rust-lang#110963 when the lifetimes are late-bound, but does not do so when the lifetimes are early-bound (as seen from the known-bug that I added).
… r=cjgillot Don't duplicate anonymous lifetimes for async fn in traits `record_lifetime_params_for_async` needs to be called outside of the scope of the function, or else it'll end up collecting anonymous lifetimes twice (those on the function and those within the `AnonymousCreateParameter` rib). This matches how `record_lifetime_params_for_async` is being used for functions with bodies below. This fixes (partially) rust-lang#110963 when the lifetimes are late-bound, but does not do so when the lifetimes are early-bound (as seen from the known-bug that I added).
What’s the status on this? Can I help progress this? With some mentoring I do not mind volunteering dev time to help moving
F-async_fn_in_trait
|
The fix for this is not clear, possibly related to a far more general problem with async (#110338), and probably not mentorable unfortunately :( This issue is not blocking async fn in trait stabilization, though. |
Ok. Does seem like an easy issue to run into for which I do not see a workaround. But I’ll trust you at your word. Thx! |
I tried this code:
I expected to see this happen: it works
Instead, this happened:
The text was updated successfully, but these errors were encountered: