You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<anon>:5:15: 5:19 error: cannot borrow immutable argument `self` as mutable
<anon>:5 (&mut self).bar();
^~~~
<anon>:4:17: 4:21 help: to make the argument mutable, use `mut` as shown:
<anon>: fn foo(&mut mut self) {
error: aborting due to previous error
playpen: application terminated with error code 101
The text was updated successfully, but these errors were encountered:
The argument self is of type &mut Self but it is, itself, immutable. You can't redefine self to point at somebody else. The rest of the message is nonsensical because it fails to realize that self is the specialest of special cases in terms of method signature parsing.
Havvy
changed the title
Error message thinks mutable argument is immutable?
Error message suggests illegal syntax for method receiver &mut Self
Feb 5, 2016
Havvy
changed the title
Error message suggests illegal syntax for method receiver &mut Self
Error message suggests illegal syntax for method receiver
Feb 5, 2016
Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s...
Fixesrust-lang#31424.
borrowck: do not suggest to change "&mut self" to "&mut mut self"
Matching the snippet string might not be the cleanest, but matching
the AST node instead seems to end in a lot of nested `if let`s, so I
don't know what's better.
Of course it's entirely possible that there is another API altogether
that I just don't know of?
Fixes#31424.
Output:
The text was updated successfully, but these errors were encountered: