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

Lint for locals living through yield points even though they're not used anymore #4893

Open
nayato opened this issue Dec 10, 2019 · 0 comments
Labels
A-lint Area: New lints L-correctness Lint: Belongs in the correctness lint group T-async-await Type: Issues related to async/await

Comments

@nayato
Copy link

nayato commented Dec 10, 2019

I tend to not analyze when or in what order locals go out of scope in sync code unless compiler starts complaining. And it seems OK to mostly not care because everything's going to be dropped shortly. I imagine other people might have the same attitude.

With locals being held across yield points in async methods, it might turn out to be much more problematic. While there are cases when you'd get reminded quickly (e.g. !Send local in Future + Send) Notable mishaps that I can imagine:

  • unnecessarily holding on to response data from after first await that was used to create next request. People don't really want to hold on to something they don't need. Especially if it's a few KBs in size and future will not complete for another minute. And there's 5K futures / sec like that.
  • taking lock and mistakenly thinking that it's released. I think it is rare to need to lock across yield points.
  • generally assuming drop will happen at yield point and planning logic with that in mind.
@flip1995 flip1995 added L-correctness Lint: Belongs in the correctness lint group A-lint Area: New lints T-async-await Type: Issues related to async/await labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints L-correctness Lint: Belongs in the correctness lint group T-async-await Type: Issues related to async/await
Projects
None yet
Development

No branches or pull requests

2 participants