Skip to content
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

Extract into function assist fails to add .await when extracting an async fn #9287

Closed
jplatte opened this issue Jun 15, 2021 · 1 comment · Fixed by #9314
Closed

Extract into function assist fails to add .await when extracting an async fn #9287

jplatte opened this issue Jun 15, 2021 · 1 comment · Fixed by #9314
Labels
A-assists E-easy S-actionable Someone could pick this issue up and work on it right now

Comments

@jplatte
Copy link
Contributor

jplatte commented Jun 15, 2021

Since #8766, extracting some code into a function generates an async fn if that code includes a .await point. However, the call to the generated function is not .awaited, leading to the code not compiling in many cases, or even the code still compiling but the async task not being executed. For example, when extracting

tokio::time::sleep(Duration::from_millis(50)).await;

as sleep50ms, the call ends up as just

sleep50ms();

when it should be

sleep50ms().await;
@jplatte
Copy link
Contributor Author

jplatte commented Jun 15, 2021

cc @JamieCunliffe who implemented #8766.

@flodiebold flodiebold added A-assists E-easy S-actionable Someone could pick this issue up and work on it right now labels Jun 15, 2021
@bors bors bot closed this as completed in 5567b8a Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-assists E-easy S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants