-
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
adjust desugaring for async fn to correct drop order #64525
adjust desugaring for async fn to correct drop order #64525
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
6b2fa9e
to
edb1a6f
Compare
r? @cramertj (I guess) |
Old desugaring, given a user function body { $stmts; $expr } ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; $stmts; $expr } ``` New desugaring: ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; drop-temps { $stmts; $expr } } ``` The drop-temps is an internal bit of HIR that drops temporaries from the resulting expression, but it should be equivalent to `return { $stmts; $expr }`.
edb1a6f
to
00d1590
Compare
@cramertj is on vacation -- maybe @davidtwco feels up to reviewing this? r? @davidtwco If you don't, though, let me know and we'll find somebody else. =) |
This looks correct to me. If no reviewer gets a chance to see it in a timely manner, r=me. |
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
src/test/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs
Outdated
Show resolved
Hide resolved
@bors p=1 |
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
bbf0439
to
291fb31
Compare
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! r=me when CI is passing.
DropTemps(...) looks like a function, this looks like wacko special stuff
291fb31
to
2d8b10f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, just remembered, will the reference need updated with this change? rust-lang/reference#674 is still open from the initial change.
@bors r=davidtwco |
📌 Commit 2d8b10f has been approved by |
I was planning to take a look at the reference and decide what needed to be updated. |
… r=davidtwco adjust desugaring for async fn to correct drop order Old desugaring, given a user function body `{ $stmts; $expr }` ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; $stmts; $expr } ``` New desugaring: ``` { let $param_pattern0 = $raw_param0; ... let $param_patternN = $raw_paramN; drop-temps { $stmts; $expr } } ``` The drop-temps is an internal bit of HIR that drops temporaries from the resulting expression, but it should be equivalent to `return { $stmts; $expr }`. Fixes #64512 Fixes #64391
☀️ Test successful - checks-azure |
Old desugaring, given a user function body
{ $stmts; $expr }
New desugaring:
The drop-temps is an internal bit of HIR that drops temporaries from the resulting expression, but it should be equivalent to
return { $stmts; $expr }
.Fixes #64512
Fixes #64391