about summary refs log tree commit diff
path: root/tests/ui/mut
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-01-28 19:35:31 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-01-28 19:35:51 +0000
commit130b0d294a3404b5827869de5712009f91724700 (patch)
treed7735a7124afcecd9b61323715ea1759c8f54a5a /tests/ui/mut
parent2f348cb7ce4063fa4eb40038e6ada3c5214717bd (diff)
downloadrust-130b0d294a3404b5827869de5712009f91724700.tar.gz
rust-130b0d294a3404b5827869de5712009f91724700.zip
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`.
Diffstat (limited to 'tests/ui/mut')
-rw-r--r--tests/ui/mut/mutable-class-fields-2.stderr2
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/ui/mut/mutable-class-fields-2.stderr b/tests/ui/mut/mutable-class-fields-2.stderr
index eb0c54f885b..7a6ff4da2bf 100644
--- a/tests/ui/mut/mutable-class-fields-2.stderr
+++ b/tests/ui/mut/mutable-class-fields-2.stderr
@@ -7,7 +7,7 @@ LL |     self.how_hungry -= 5;
 help: consider changing this to be a mutable reference
    |
 LL |   pub fn eat(&mut self) {
-   |              ~~~~~~~~~
+   |               +++
 
 error: aborting due to 1 previous error