-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Using anonymous lifetimes fails to compile #18
Comments
Thanks! I won't be able to fix this right away but I would accept a PR with a fix. We need to figure out where the macro is incorrectly copying the |
Well, looked briefly, but this is over my head. This is the generated code: impl Foo for Bar<'_> {
fn test<'life0, 'async_trait>(
value: &'life0 Baz,
) -> core::pin::Pin<
Box<dyn core::future::Future<Output = ()> + core::marker::Send + 'async_trait>,
>
where
'life0: 'async_trait,
{
async fn __test(value: &Baz) {}
core::pin::Pin::from(Box::new(__test(value)))
}
} Which doesn't compile. impl<'a> Foo for Bar<'a> {
fn test<'life0, 'async_trait>(
value: &'life0 Baz,
) -> core::pin::Pin<
Box<dyn core::future::Future<Output = ()> + core::marker::Send + 'async_trait>,
>
where
'life0: 'async_trait,
{
async fn __test<'a>(value: &Baz) {}
core::pin::Pin::from(Box::new(__test(value)))
}
} Then there's this that does work: impl Foo for Bar<'_> {
fn test<'life0, 'async_trait>(
value: &'life0 Baz,
) -> core::pin::Pin<
Box<dyn core::future::Future<Output = ()> + core::marker::Send + 'async_trait>,
>
where
'life0: 'async_trait,
{
core::pin::Pin::from(Box::new(async move {}))
}
} But just including the So this seems to be some subtle interaction with how rustc deals with the desugaring of the nested |
I guess it's a compiler bug. Let's close in favor of tracking this in rust-lang/rust#63225. Thanks! |
The following:
Results in:
The text was updated successfully, but these errors were encountered: