Improve diagnostic for wrong borrow on binary operations#114288
Merged
bors merged 1 commit intorust-lang:masterfrom Aug 1, 2023
Merged
Improve diagnostic for wrong borrow on binary operations#114288bors merged 1 commit intorust-lang:masterfrom
bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
|
r? @b-naber (rustbot has picked a reviewer for you, use r? to override) |
b-naber
reviewed
Jul 31, 2023
compiler/rustc_hir_typeck/src/op.rs
Outdated
Contributor
There was a problem hiding this comment.
ast::Mutability has methods for this: https://doc.rust-lang.org/stable/nightly-rustc/rustc_ast/ast/enum.Mutability.html#method.is_not
Member
Author
There was a problem hiding this comment.
Done, but using is_not() meant adding type inference to the closure, not sure if it's better.
b-naber
reviewed
Jul 31, 2023
Contributor
|
Looks great. Thanks! Btw it's a little easier to review, if you push new commits that address a review instead of force pushing. @bors r+ rollup |
Collaborator
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 1, 2023
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#100455 (Implement RefUnwindSafe for Backtrace) - rust-lang#113428 (coverage: Replace `ExpressionOperandId` with enum `Operand`) - rust-lang#114283 (Use parking lot's rwlock even without parallel-rustc) - rust-lang#114288 (Improve diagnostic for wrong borrow on binary operations) - rust-lang#114296 (interpret: fix alignment handling for Repeat expressions) - rust-lang#114306 ([rustc_data_structures][perf] Simplify base_n::push_str.) - rust-lang#114320 (Cover statements for stable_mir) r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves the diagnostic for wrong borrow on binary operations by suggesting to reborrow on appropriate expressions.
Fixes #109352