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

Check assign_op_pattern for conflicting borrows #9214

Merged
merged 1 commit into from
Jul 21, 2022

Conversation

Jarcho
Copy link
Contributor

@Jarcho Jarcho commented Jul 20, 2022

fixes #9180

changelog: assign_op_pattern: Don't lint when the suggestion would cause borrowck errors.

@rust-highfive
Copy link

r? @Manishearth

(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 Jul 20, 2022
Copy link
Member

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

r=me either way

@@ -99,3 +113,69 @@ impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
walk_expr(self, expr);
}
}

fn imm_borrows_in_expr(cx: &LateContext<'_>, e: &hir::Expr<'_>) -> hir::HirIdSet {
Copy link
Member

Choose a reason for hiding this comment

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

thought: should these live in utils?

also worth adding a doc comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would imagine anything else would need to gather a list of all borrows, not just mutable or immutable ones.

Copy link
Member

Choose a reason for hiding this comment

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

ah fair

@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 21, 2022

📌 Commit a2f9b93 has been approved by Manishearth

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jul 21, 2022

⌛ Testing commit a2f9b93 with merge 05a51e5...

@bors
Copy link
Contributor

bors commented Jul 21, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Manishearth
Pushing 05a51e5 to master...

@bors bors merged commit 05a51e5 into rust-lang:master Jul 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

assign_op_pattern suggested change is a compiler error for non-primitive vector elements
4 participants