Skip to content

changed the information provided by (mut x) to mut x (Fix 155030)#155095

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
lms0806:issue_155030
Apr 17, 2026
Merged

changed the information provided by (mut x) to mut x (Fix 155030)#155095
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
lms0806:issue_155030

Conversation

@lms0806
Copy link
Copy Markdown
Contributor

@lms0806 lms0806 commented Apr 10, 2026

When trying to change a value without using mut in a for loop, the recommendation for this change is incorrect, so I am correcting it.

resolve: #155030

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 10, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 10, 2026

r? @nnethercote

rustbot has assigned @nnethercote.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: borrowck, compiler
  • borrowck, compiler expanded to 69 candidates
  • Random selection from 12 candidates

Copy link
Copy Markdown
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

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

The PR title and description need updating: they should provide a brief description of the change being made. (The PR description can include the words "Fixes 155095" so that GitHub knows this is a fix for that issue.)

Also, for next time, when doing a PR that changes an error message and also adds a new ui test, it's very helpful for reviewers if you add the new ui test in the first commit, and then make the error message change in the second commit. That way the change in behaviour is completely clear.

View changes since this review

if let Ok(pat_snippet) =
self.infcx.tcx.sess.source_map().span_to_snippet(pat_span)
{
if pat_snippet.trim_start().starts_with('&') {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Converting to a string and then doing a string search is not the right way to do this. There must be a way to achieve the same behaviour by inspecting the IR data structure directly.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Starting with the next issue handling, we will separate the commits for adding new tests from the commits for resolving the issue.

We will make the necessary corrections to the code you mentioned as soon as possible.

Thank you for your explanation.

@nnethercote nnethercote 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 Apr 13, 2026
@lms0806 lms0806 changed the title resolve : issue 155030 solve changed the information provided by (mut x) to mut x (Fix 155030) Apr 15, 2026
@lms0806 lms0806 closed this Apr 15, 2026
@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 Apr 15, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 15, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@lms0806 lms0806 reopened this Apr 15, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 15, 2026
@nnethercote
Copy link
Copy Markdown
Contributor

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented Apr 16, 2026

📌 Commit be3f77c has been approved by nnethercote

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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 Apr 16, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 16, 2026
changed the information provided by (mut x) to mut x (Fix 155030)

When trying to change a value without using mut in a for loop, the recommendation for this change is incorrect, so I am correcting it.

resolve: rust-lang#155030
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 16, 2026
changed the information provided by (mut x) to mut x (Fix 155030)

When trying to change a value without using mut in a for loop, the recommendation for this change is incorrect, so I am correcting it.

resolve: rust-lang#155030
GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Apr 16, 2026
changed the information provided by (mut x) to mut x (Fix 155030)

When trying to change a value without using mut in a for loop, the recommendation for this change is incorrect, so I am correcting it.

resolve: rust-lang#155030
rust-bors Bot pushed a commit that referenced this pull request Apr 17, 2026
Rollup of 13 pull requests

Successful merges:

 - #152980 (c-variadic: fix implementation on `avr`)
 - #154491 (Extend `core::char`'s documentation of casing issues (and fix a rustdoc bug))
 - #155354 (Remove AttributeSafety from BUILTIN_ATTRIBUTES)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155095 (changed the information provided by (mut x) to mut x (Fix 155030))
 - #155358 (ImproperCTypes: Move erasing_region_normalisation into helper function)
 - #155377 (tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs)
 - #155383 (Rearrange `rustc_ast_pretty`)
 - #155384 (triagebot: notify on diagnostic attribute changes)
 - #155386 (Use `box_new` diagnostic item for Box::new suggestions)
 - #155391 (Small refactor of `QueryJob::latch` method)
 - #155395 (Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc)
 - #155396 (`as_ref_unchecked` docs link fix)
rust-bors Bot pushed a commit that referenced this pull request Apr 17, 2026
Rollup of 19 pull requests

Successful merges:

 - #141633 (Suggest to bind `self.x` to `x` when field `x` may be in format string)
 - #152980 (c-variadic: fix implementation on `avr`)
 - #154491 (Extend `core::char`'s documentation of casing issues (and fix a rustdoc bug))
 - #155318 (Use mutable pointers for Unix path buffers)
 - #155335 (Bump bootstrap to 1.96 beta)
 - #155354 (Remove AttributeSafety from BUILTIN_ATTRIBUTES)
 - #154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - #155095 (changed the information provided by (mut x) to mut x (Fix 155030))
 - #155305 (Make `convert_while_ascii` unsafe)
 - #155358 (ImproperCTypes: Move erasing_region_normalisation into helper function)
 - #155377 (tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs)
 - #155383 (Rearrange `rustc_ast_pretty`)
 - #155384 (triagebot: notify on diagnostic attribute changes)
 - #155386 (Use `box_new` diagnostic item for Box::new suggestions)
 - #155391 (Small refactor of `QueryJob::latch` method)
 - #155395 (Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc)
 - #155396 (`as_ref_unchecked` docs link fix)
 - #155411 (compiletest: Remove the `//@ should-ice` directive)
 - #155413 (fix: typo in `std::fs::hard_link` documentation)
@rust-bors rust-bors Bot merged commit 350e0d7 into rust-lang:main Apr 17, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone Apr 17, 2026
rust-timer added a commit that referenced this pull request Apr 17, 2026
Rollup merge of #155095 - lms0806:issue_155030, r=nnethercote

changed the information provided by (mut x) to mut x (Fix 155030)

When trying to change a value without using mut in a for loop, the recommendation for this change is incorrect, so I am correcting it.

resolve: #155030
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 20, 2026
Rollup of 19 pull requests

Successful merges:

 - rust-lang/rust#141633 (Suggest to bind `self.x` to `x` when field `x` may be in format string)
 - rust-lang/rust#152980 (c-variadic: fix implementation on `avr`)
 - rust-lang/rust#154491 (Extend `core::char`'s documentation of casing issues (and fix a rustdoc bug))
 - rust-lang/rust#155318 (Use mutable pointers for Unix path buffers)
 - rust-lang/rust#155335 (Bump bootstrap to 1.96 beta)
 - rust-lang/rust#155354 (Remove AttributeSafety from BUILTIN_ATTRIBUTES)
 - rust-lang/rust#154970 (rustdoc: preserve `doc(cfg)` on locally re-exported type aliases)
 - rust-lang/rust#155095 (changed the information provided by (mut x) to mut x (Fix 155030))
 - rust-lang/rust#155305 (Make `convert_while_ascii` unsafe)
 - rust-lang/rust#155358 (ImproperCTypes: Move erasing_region_normalisation into helper function)
 - rust-lang/rust#155377 (tests/debuginfo/basic-stepping.rs: Remove FIXME related to ZSTs)
 - rust-lang/rust#155383 (Rearrange `rustc_ast_pretty`)
 - rust-lang/rust#155384 (triagebot: notify on diagnostic attribute changes)
 - rust-lang/rust#155386 (Use `box_new` diagnostic item for Box::new suggestions)
 - rust-lang/rust#155391 (Small refactor of `QueryJob::latch` method)
 - rust-lang/rust#155395 (Tweak how the "copy path" rustdoc button works to allow some accessibility tool to work with rustdoc)
 - rust-lang/rust#155396 (`as_ref_unchecked` docs link fix)
 - rust-lang/rust#155411 (compiletest: Remove the `//@ should-ice` directive)
 - rust-lang/rust#155413 (fix: typo in `std::fs::hard_link` documentation)
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.

Assigning to a for loop's element suggests replacing it with invalid code

3 participants