-
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
Moved value is considered as held across an await
in async fn
#87309
Comments
@rustbot modify labels +A-async-await |
Here is a reduced example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=8e17d9e4b6c20ad7f3291c92aa648969 use std::rc::Rc;
async fn non_trivial_drop() {
let x = Rc::new(vec![0]);
drop(x);
async {}.await;
}
fn assert_send<T: Send>(_: T) {}
fn main() {
assert_send(non_trivial_drop());
} |
Does your example work with |
hmm, #69663 doesn't mention -Zdrop-tracking though - I would love to help get that onto stable :) let me know if there's anything I can do. |
#69663 is the umbrella bug for all overly aggressive generator captures, but there are several distinct causes for them. The case you listed looks most like #57478, which is what I've been linked most of the drop tracking work to. There are a couple of pending PRs fixing bugs in it, such as #96923 and #97029. Once #96923 merges, I think that fixes all the major bugs I know about so the next step will be to do a crater run to make sure we don't have any other bugs lurking around. |
Actually, @jyn514, one issue I haven't been able to look at yet is |
Sure! let me take a look :) |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This issue seems to be solved now, the playground link compiles fine and everything listed in the tracking issue is marked as done (even though the tracking issue itself isn't) |
Given the above comments I'll go ahead and close this. @eholk I am assuming the drop tracking has enough tests and we don't need to do anything here? |
I tried this code:
[playground]
I expected to see this happen: the code compiles.
Instead, this happened: the following compile error:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: