Skip to content

Conversation

@reddevilmidzy
Copy link
Contributor

@reddevilmidzy reddevilmidzy commented Nov 19, 2025

resolve: #148467

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@reddevilmidzy reddevilmidzy marked this pull request as ready for review November 23, 2025 10:01
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 23, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 23, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@lcnr
Copy link
Contributor

lcnr commented Nov 24, 2025

currently quite swamped, sorry

@rustbot reroll

@rustbot rustbot assigned eholk and unassigned lcnr Nov 24, 2025
@Morgane55440
Copy link

hey, i'm the one who opened this issue, thanks for taking the time to work on this !
just to make sure we are on the same page, i'd like to note that the second help message, that you haven't touched, is also incorrect. (the original value cannot be modified because it is behind a & binding)

help: to modify the original value, take a borrow instead
  |
4 |     for &ref mut x in s {
  |          +++++++

that was not in the title, and i did not go in big details on it, but i did try to fix it in the Desired output part.
if you feel it should be done in another PR, or eventhat another issue should be opened, i completely understand, but i'd just like to make sure you didn't just miss it.

@reddevilmidzy
Copy link
Contributor Author

@Morgane55440 Thank you for checking:)
I also knew the second help message was wrong, but since it wasn't mentioned in the issue, I just added parentheses for this PR(To keep the task small). I agree to remove the second message as well, so I'll do it together in this PR.

@reddevilmidzy reddevilmidzy marked this pull request as draft November 28, 2025 10:38
@rustbot rustbot 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 Nov 28, 2025
@reddevilmidzy
Copy link
Contributor Author

I chose to keep the ref mut suggestion for this case.

fn main() {
    match 1 {
        x => {
            x += 1;
        }
    }

    let y = Some(0);
    if let Some(x) = y {
        x = 2;
    }
}

Although applying ref mut results in a compilation error, the error can be resolved afterward thanks to the additional suggestions (use deref, use mut).

@reddevilmidzy reddevilmidzy marked this pull request as ready for review December 4, 2025 06:21
@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 Dec 4, 2025
@eholk
Copy link
Contributor

eholk commented Dec 5, 2025

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Dec 5, 2025

📌 Commit d49075f has been approved by eholk

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 Dec 5, 2025
bors added a commit that referenced this pull request Dec 5, 2025
Rollup of 11 pull requests

Successful merges:

 - #148662 (alloc: Document panics when allocations will exceed max)
 - #148811 (core docs: rewrite `panic::Location::caller` with visual line/column numbers)
 - #149101 (Improve mutable-binding suggestion to include name)
 - #149477 (float::maximum/minimum: make docs more streamlined)
 - #149547 (library: Rename `IterRange*` to `Range*Iter`)
 - #149548 (Generate delegation error body when delegation is not resolved)
 - #149630 (Check identifiers defined in macros when suggesting identifiers hidden by hygiene)
 - #149647 (Add regression test for 141845)
 - #149661 (Fix for LLVM22 making lowering decisions dependent on RuntimeLibraryInfo.)
 - #149666 (Add perma-unstable `--print=backend-has-zstd` for use by compiletest)
 - #149671 (interpret: test SNaN handling of float min/max and update comments)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7850fc4 into rust-lang:main Dec 5, 2025
11 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Dec 5, 2025
rust-timer added a commit that referenced this pull request Dec 5, 2025
Rollup merge of #149101 - reddevilmidzy:mutable, r=eholk

Improve mutable-binding suggestion to include name

resolve: #148467
@reddevilmidzy reddevilmidzy deleted the mutable branch December 5, 2025 23:45
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 6, 2025
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#148662 (alloc: Document panics when allocations will exceed max)
 - rust-lang/rust#148811 (core docs: rewrite `panic::Location::caller` with visual line/column numbers)
 - rust-lang/rust#149101 (Improve mutable-binding suggestion to include name)
 - rust-lang/rust#149477 (float::maximum/minimum: make docs more streamlined)
 - rust-lang/rust#149547 (library: Rename `IterRange*` to `Range*Iter`)
 - rust-lang/rust#149548 (Generate delegation error body when delegation is not resolved)
 - rust-lang/rust#149630 (Check identifiers defined in macros when suggesting identifiers hidden by hygiene)
 - rust-lang/rust#149647 (Add regression test for 141845)
 - rust-lang/rust#149661 (Fix for LLVM22 making lowering decisions dependent on RuntimeLibraryInfo.)
 - rust-lang/rust#149666 (Add perma-unstable `--print=backend-has-zstd` for use by compiletest)
 - rust-lang/rust#149671 (interpret: test SNaN handling of float min/max and update comments)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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.

compiler incorrectly suggest converting &x ->&mut x instead of &(mut x) when matching on a &T(T : Copy)

7 participants