-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Tweak &mut self
suggestion span
#136212
Merged
Merged
Tweak &mut self
suggestion span
#136212
Conversation
This file contains 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
``` error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | LL | fn f(&mut self) { | +++ ``` Note the suggestion to add `mut` instead of replacing the entire `&self` with `&mut self`.
rustbot has assigned @petrochenkov. Use |
@bors r+ rollup |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Jan 29, 2025
Tweak `&mut self` suggestion span ``` error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | LL | fn f(&mut self) { | +++ ``` Note the suggestion to add `mut` instead of replacing the entire `&self` with `&mut self`.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 29, 2025
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#133382 (Suggest considering casting fn item as fn pointer in more cases) - rust-lang#136092 (Test pipes also when not running on Windows and Linux simultaneously) - rust-lang#136190 (Remove duplicated code in RISC-V asm bad-reg test) - rust-lang#136192 (ci: remove unused windows runner) - rust-lang#136205 (Properly check that array length is valid type during built-in unsizing in index) - rust-lang#136211 (Update mdbook to 0.4.44) - rust-lang#136212 (Tweak `&mut self` suggestion span) - rust-lang#136214 (Make crate AST mutation accessible for driver callback) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Jan 29, 2025
Rollup merge of rust-lang#136212 - estebank:span-tweak, r=petrochenkov Tweak `&mut self` suggestion span ``` error[E0596]: cannot borrow `*self.s` as mutable, as it is behind a `&` reference --> $DIR/issue-38147-1.rs:17:9 | LL | self.s.push('x'); | ^^^^^^ `self` is a `&` reference, so the data it refers to cannot be borrowed as mutable | help: consider changing this to be a mutable reference | LL | fn f(&mut self) { | +++ ``` Note the suggestion to add `mut` instead of replacing the entire `&self` with `&mut self`.
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.
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.
Note the suggestion to add
mut
instead of replacing the entire&self
with&mut self
.