-
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
Behavior of async fn
and return position impl Future
differs
#109572
Comments
Your async fn de-sugars to:
Note the extra If you capture the lifetime explicitly in the
you'll get the same error again. Duplicate of #41078 |
Does that means I would have expected the future become invalid once the reference goes out of scope. Edit: I think there's an explanation in https://rust-lang.github.io/async-book/03_async_await/01_chapter.html#async-lifetimes . |
I tried this code:
I expected to behave identically when I change the function
inner
to:According to async-lifetimes, that is.
Instead, the
-> impl Future
version compiles fine, and the async function version give this error on current stable(1.68.1) & beta(1.69.0-beta.3):And this message on nightly:
Meta
rustc --version --verbose
:I tried stable, beta and nightly.
The text was updated successfully, but these errors were encountered: