Assignment to immutable argument: diagnostic tweak#47261
Assignment to immutable argument: diagnostic tweak#47261bors merged 2 commits intorust-lang:masterfrom
Conversation
|
(rust_highfive has picked a reviewer for you, use r? to override) |
4a01467 to
1890818
Compare
| 14 | _x = 4; | ||
| | ^^^^^^ cannot assign twice to immutable variable | ||
|
|
||
| error[E0384]: cannot assign twice to immutable variable `_x` (Mir) |
There was a problem hiding this comment.
Shouldn't this message say "argument" instead of "variable" as well?
efd08e0 to
e1ee593
Compare
e1ee593 to
90bc98c
Compare
|
@bors r+ |
|
📌 Commit 90bc98c has been approved by |
| } | ||
| } else { | ||
| false | ||
| }; |
There was a problem hiding this comment.
So
much
vertical
space.
Now every time I see stuff like this I'm rewording it with is expressions in my head.
let is_arg = place is Place::Local(local) && self.mir.local_kind(*local) is LocalKind::Arg;There was a problem hiding this comment.
@petrochenkov To be fair this is just:
let is_arg = match place {
Place::Local(local) => self.mir.local_kind(*local) == LocalKind::Arg,
_ => false
};I think if let is overused and match is better in many cases.
There was a problem hiding this comment.
True, I usually revert to using match in cases like this. Somehow it escaped me here ^_^
Assignment to immutable argument: diagnostic tweak Re #46659.
|
☀️ Test successful - status-appveyor, status-travis |
Re #46659.