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

Add suggestion to use closure argument instead of a capture on borrowck error #110061

Merged
merged 5 commits into from
Apr 20, 2023

Conversation

WaffleLapkin
Copy link
Member

Fixes #109271
r? @compiler-errors

This should probably be refined a bit, but opening a PR so that I don't forget anything.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 7, 2023
@WaffleLapkin WaffleLapkin added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 7, 2023
@rust-log-analyzer

This comment has been minimized.

@WaffleLapkin WaffleLapkin added A-diagnostics Area: Messages for errors, warnings, and lints A-closures Area: closures (`|args| { .. }`) A-borrow-checker Area: The borrow checker labels Apr 7, 2023
@WaffleLapkin
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 12, 2023
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Apr 16, 2023

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

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented Apr 17, 2023

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

@compiler-errors
Copy link
Member

r? @cjgillot

@cjgillot
Copy link
Contributor

r=me with review commits squashed into main commits

While it might *seem* that this does something, it actually doesn't.
`mut_borrow_of_mutable_ref` returns a `bool` that is ignored by the
let-else. This was basically
```rust
if !self.body.local_decls.get(local).is_some() {
    return
}
```
Which is pretty useless
We use caller information to track where a diagnostic was created,
so all "helper" diagnostic functions should use `#[track_caller]`
@WaffleLapkin
Copy link
Member Author

@bors r=cjgillot

I've cleaned-up the git history

@bors
Copy link
Contributor

bors commented Apr 19, 2023

📌 Commit cac143f has been approved by cjgillot

It is now in the queue for this repository.

@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 Apr 19, 2023
@bors
Copy link
Contributor

bors commented Apr 19, 2023

⌛ Testing commit cac143f with merge b9fd498...

@bors
Copy link
Contributor

bors commented Apr 20, 2023

☀️ Test successful - checks-actions
Approved by: cjgillot
Pushing b9fd498 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 20, 2023
@bors bors merged commit b9fd498 into rust-lang:master Apr 20, 2023
@rustbot rustbot added this to the 1.71.0 milestone Apr 20, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (b9fd498): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
3.8% [3.8%, 3.8%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.5% [-3.5%, -3.5%] 1
All ❌✅ (primary) 3.8% [3.8%, 3.8%] 1

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.2% [2.0%, 2.5%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker A-closures Area: closures (`|args| { .. }`) A-diagnostics Area: Messages for errors, warnings, and lints 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.

Detect unused "passing self into closure" pattern to side-step borrow checker
7 participants