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

Closure capture cleanup & refactor #89861

Merged
merged 4 commits into from
Jan 13, 2022
Merged

Closure capture cleanup & refactor #89861

merged 4 commits into from
Jan 13, 2022

Conversation

nbdd0121
Copy link
Contributor

Follow up of #89648

Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit.

The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run.

r? @wesleywiser
cc @arora-aman

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 13, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@jackh726
Copy link
Member

@bors try @rust-timer queue

@rust-timer
Copy link
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 13, 2021
@bors
Copy link
Contributor

bors commented Oct 13, 2021

⌛ Trying commit 691f14023ffcb4e6591655228cdc358b00f282b9 with merge 141f36eb94d72f67dfd9c393c50026f544b48579...

@Mark-Simulacrum
Copy link
Member

@rust-timer build 141f36eb94d72f67dfd9c393c50026f544b48579

@rust-timer
Copy link
Collaborator

Queued 141f36eb94d72f67dfd9c393c50026f544b48579 with parent eeb16a2, future comparison URL.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (141f36eb94d72f67dfd9c393c50026f544b48579): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR led to changes in compiler perf.

@bors rollup=never
@rustbot label: +S-waiting-on-review -S-waiting-on-perf -perf-regression

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Oct 14, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 14, 2021
@nbdd0121
Copy link
Contributor Author

Rebased to address conflict with #89933 since both introduces some use of let_else. Weird that bors didn't drop a message this time.

@rust-log-analyzer

This comment has been minimized.

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 8, 2021
@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2021
@bors
Copy link
Contributor

bors commented Dec 15, 2021

☔ The latest upstream changes (presumably #91945) made this pull request unmergeable. Please resolve the merge conflicts.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Dec 19, 2021

☔ The latest upstream changes (presumably #92099) made this pull request unmergeable. Please resolve the merge conflicts.

This span is unused and is superseded by capture_kind_expr_id in CaptureInfo
Region info is completely unnecessary for upvar capture kind computation
and is only needed to create the final upvar tuple ty. Doing so makes
creation of UpvarCapture very cheap and expose further cleanup opportunity.
`adjust_upvar_deref` and friends are implemented so that they reuse
existing region so new region vars don't have to be generated.
Since now we don't have to generate region vars in `InferBorrowKind`,
creating a new capture info would be cheap and we can just use
`determine_capture_info`.

syn is updated so that let_else syntax can be used in fn with `#[instrument]` attribute.

`restrict_repr_packed_field_ref_capture` is changed to take place by value
since cloning is needed anyway.
Min capture computation can already handle the same place appearing twice,
and previous commits made CaptureInfo construction very cheap, so just
delegate all work to min capture and let InferBorrowKind and
process_collected_capture_information handle everything linearly.
Copy link
Member

@wesleywiser wesleywiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay in review, this looks really great!

@wesleywiser
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 13, 2022

📌 Commit c84cea9 has been approved by wesleywiser

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 13, 2022
@bors
Copy link
Contributor

bors commented Jan 13, 2022

⌛ Testing commit c84cea9 with merge 22e491a...

@bors
Copy link
Contributor

bors commented Jan 13, 2022

☀️ Test successful - checks-actions
Approved by: wesleywiser
Pushing 22e491a to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 13, 2022
@bors bors merged commit 22e491a into rust-lang:master Jan 13, 2022
@rustbot rustbot added this to the 1.60.0 milestone Jan 13, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (22e491a): comparison url.

Summary: This benchmark run did not return any relevant changes.

If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf.

@rustbot label: -perf-regression

@nbdd0121 nbdd0121 deleted the closure branch January 14, 2022 03:08
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 27, 2022
Closure capture cleanup & refactor

Follow up of rust-lang#89648

Each commit is self-contained and the rationale/changes are documented in the commit message, so it's advisable to review commit by commit.

The code is significantly cleaner (at least IMO), but that could have some perf implication, so I'd suggest a perf run.

r? `@wesleywiser`
cc `@arora-aman`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.