Skip to content

Some borrowck diagnostic fixes #98603

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged

Conversation

compiler-errors
Copy link
Member

  1. Remove some redundant .as_ref suggestion logic from borrowck, this has the consequence of also not suggesting .as_ref after Option methods, but (correctly) before.
  2. Fix a bug where we were replacing a binding's name with a type. Instead, make it a note.

This is somewhat incomplete. See src/test/ui/borrowck/suggest-as-ref-on-mut-closure.rs for more improvements.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Jun 28, 2022
@rust-highfive
Copy link
Contributor

r? @davidtwco

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 28, 2022
Copy link
Member

@davidtwco davidtwco left a comment

Choose a reason for hiding this comment

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

LGTM, one very minor nit, r=me w/ or w/out fixing

// This is not exactly right, yet.

// Ideally we should be suggesting `as_mut` for the first case,
//and suggesting to change `as_ref` to `as_mut` in the second.
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
//and suggesting to change `as_ref` to `as_mut` in the second.
// and suggesting to change `as_ref` to `as_mut` in the second.

@compiler-errors compiler-errors force-pushed the minor-borrowck-diagnostic-fixes branch from 8fb6ad3 to 8fd7356 Compare June 28, 2022 22:35
@compiler-errors
Copy link
Member Author

@bors r=davidtwco

@compiler-errors
Copy link
Member Author

@bors ping

@bors
Copy link
Collaborator

bors commented Jun 28, 2022

😪 I'm awake I'm awake

@compiler-errors
Copy link
Member Author

@bors r=davidtwco

@bors
Copy link
Collaborator

bors commented Jun 28, 2022

📌 Commit 8fd7356 has been approved by davidtwco

@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 Jun 28, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 29, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#97423 (Simplify memory ordering intrinsics)
 - rust-lang#97542 (Use typed indices in argument mismatch algorithm)
 - rust-lang#97786 (Account for `-Z simulate-remapped-rust-src-base` when resolving remapped paths)
 - rust-lang#98277 (Fix trait object reborrow suggestion)
 - rust-lang#98525 (Add regression test for rust-lang#79224)
 - rust-lang#98549 (interpret: do not prune requires_caller_location stack frames quite so early)
 - rust-lang#98603 (Some borrowck diagnostic fixes)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 25fb2b4 into rust-lang:master Jun 29, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jun 29, 2022
@compiler-errors compiler-errors deleted the minor-borrowck-diagnostic-fixes branch August 11, 2023 20:07
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
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.

5 participants