-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Can't return impl trait inside a type when using HRTBs #67262
Comments
Seeing as it's been a while since the last activity on this and I just hit it, I'm just allowing myself to say this is still an issue :) Here is a playground link if it can help reproducing with the latest nightly for future people who might come in here without having hit the issue themselves. |
Current error:
|
"Fixed"1 by feature
F-closure_lifetime_binder
#![feature(closure_lifetime_binder)]
struct Wrapper<T>(T);
fn allowed() -> impl for<'a> Fn(&'a u32) -> &'a u32 {
|x: &u32| x
}
fn not_allowed() -> Wrapper<impl for<'a> Fn(&'a u32) -> &'a u32> {
Wrapper(for<'a> |x: &'a u32| -> &'a u32 { x })
} Footnotes
|
This code fails to compile:
The message is:
I think this may be related to #54729 but it isn't quite clear. Certainly the workaround mentioned there does not work in this case.
The text was updated successfully, but these errors were encountered: