-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Remove invalid case for mutable borrow suggestion #105655
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
Merged
Conversation
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
If we have a call such as `foo(&mut buf)` and after reference collapsing the type is inferred as `&T` where-as the required type is `&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically and the issue lies elsewhere, not in the borrow. Fixes rust-lang#105645
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @nagisa (or someone else) soon. Please see the contribution instructions for more information. |
compiler/rustc_trait_selection/src/traits/error_reporting/suggestions.rs
Outdated
Show resolved
Hide resolved
r? rust-lang/compiler |
I guess this code uses snippet logic a lot already, so it doesn't make it worse, but we should probably figure out how to clean this up and not use string matching @bors r+ rollup |
JohnTitor
pushed a commit
to JohnTitor/rust
that referenced
this pull request
Jan 9, 2023
Remove invalid case for mutable borrow suggestion If we have a call such as `foo(&mut buf)` and after reference collapsing the type is inferred as `&T` where-as the required type is `&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically and the issue lies elsewhere, not in the borrow. Fixes rust-lang#105645
JohnTitor
pushed a commit
to JohnTitor/rust
that referenced
this pull request
Jan 9, 2023
Remove invalid case for mutable borrow suggestion If we have a call such as `foo(&mut buf)` and after reference collapsing the type is inferred as `&T` where-as the required type is `&mut T`, don't suggest `foo(&mut mut buf)`. This is wrong syntactically and the issue lies elsewhere, not in the borrow. Fixes rust-lang#105645
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 9, 2023
…fee1-dead Rollup of 10 pull requests Successful merges: - rust-lang#105292 (Change a commit_if_ok call to probe) - rust-lang#105655 (Remove invalid case for mutable borrow suggestion) - rust-lang#106047 (Fix ui constant tests for big-endian platforms) - rust-lang#106061 (Enable Shadow Call Stack for Fuchsia on AArch64) - rust-lang#106164 (Move `check_region_obligations_and_report_errors` to `TypeErrCtxt`) - rust-lang#106291 (Fix incorrect suggestion for extra `&` in pattern) - rust-lang#106389 (Simplify some canonical type alias names) - rust-lang#106468 (Use FxIndexSet when updating obligation causes in `adjust_fulfillment_errors_for_expr_obligation`) - rust-lang#106549 (Use fmt named parameters in rustc_borrowck) - rust-lang#106614 (error-code docs improvements (No. 2)) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
# 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.
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.
If we have a call such as
foo(&mut buf)
and after referencecollapsing the type is inferred as
&T
where-as the required type is&mut T
, don't suggestfoo(&mut mut buf)
. This is wrong syntacticallyand the issue lies elsewhere, not in the borrow.
Fixes #105645