-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
New must_not_suspend lint triggers even when value has been moved #89562
Comments
When I encountered this in the real world, the |
The lint seems to be correct currently, since using fn is_send<T: Send>(_x: T) {}
// error: future cannot be sent between threads safely
fn main() { is_send(foo()); } Wrapping in a block will avoid this issue for now like in #57478 (comment) until there are more precise generator captures #69663 |
In my case whether the future is |
Wait it says that I closed this issue. If I did, that wasn't intentional so I'll reopen... |
To clarify, I expect once the generator captures issue improves, the lint will no longer appear in the above example (and the future will become Good to leave this open though to let someone who better understands the situation confirm if this is expected or not. @rustbot label: +A-lint +A-async-await |
That's correct, this looks like a symptom of #69663, so it should get better as generator captures improve. There may be some things we can do in the shorter term too. |
We discussed this in the triage meeting today. It is indeed a result of generator captures being too conservative. In the short term, @guswynn is working on making the lint allow by default. Longer term, we have a couple of potential fixes. One is to fix the generator captures, which I'm working on. Another option is to move the Apparently @guswynn and @nikomatsakis have also been discussing a third option that relies more on the trait system. @rustbot label +AsyncAwait-Triaged |
…nd, r=Mark-Simulacrum Feature gate + make must_not_suspend allow-by-default Fixes rust-lang#89798 and patches over rust-lang#89562 (not a true fix, since we're just disabling the lint for now).
I tried this code (playground):
I expected to see this happen: No warnings (except unused fns)
Instead, this happened:
must_not_suspend
triggeredMeta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: