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
match token {
DoctypeToken(dt) if mode == Initial => ...,
DoctypeToken(dt) => ...,
TagToken(x) => ...,
CommentToken(x) => ...,
// other cases
This gives
error: cannot bind by-move into a pattern guard
In this situation it should be fine to defer the move until the guard has succeeded.
It's a bit frivolous because I could instead do
match token {
DoctypeToken(dt) => if mode == Initial {
...
} else {
...
},
TagToken(x) => ...,
CommentToken(x) => ...,
// other cases
But I like having all the branching in one construct, especially when I'm implementing a spec which is written that way. And I don't want to add mode to the match scrutinee because none of the other cases care about it.
edit: a more trivial (but quite related) enhancement is to not emit E0008 for pattern guards that don't move anything, let alone the captures. Example.
internal: Handle fields called as method calls as the fields they resolve to
Confusing PR title tbf but this makes it so `bar` in `foo.bar()` resolves to the field if it exists and no method with the same name exists. Improves UX slightly when incorrectly calling a field.
I have
This gives
In this situation it should be fine to defer the move until the guard has succeeded.
It's a bit frivolous because I could instead do
But I like having all the branching in one construct, especially when I'm implementing a spec which is written that way. And I don't want to add
mode
to the match scrutinee because none of the other cases care about it.See also #4649.
The text was updated successfully, but these errors were encountered: