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
Based on an IRC conversation just now, I can think of two ways to improve this error message:
Because pattern guards use the "if" keyword, someone may have written one by accident. Then, if they see this error message, they're going to ask "what's a pattern guard"? The error could explain this (it's a little hard to figure out right now since the entire pattern gets underlined, not the guard).
Probably more importantly, the error should suggest what to do to fix it.
The error in question is in rustc::middle::check_match.
The text was updated successfully, but these errors were encountered:
Matching on a reference (match &obj {...}) works until you want to move the object, which was presumably the point of making it movable in the first case.
Can match substitute variables bound by the pattern (p in this case) with a reference while evaluating the guard and release the reference again before the block? Example of problem:
for entry in try!(fs::readdir(some_path)).move_iter(){
match &entry {
p if /* p a borrowing reference here */ p.is_file() => {
/* p owned, reference released here */ ...
}, ...
}
}
The best solution I have for now is to use a temporary control variable and match twice.
I'm pulling a massive triage effort to get us ready for 1.0. As part of this, I'm moving stuff that's wishlist-like to the RFCs repo, as that's where major new things should get discussed/prioritized.
Based on an IRC conversation just now, I can think of two ways to improve this error message:
The error in question is in
rustc::middle::check_match
.The text was updated successfully, but these errors were encountered: