-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Guards example may be confusing #1539
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
@skade In this case the compiler can not guarantee a matching pattern. Maybe the example should be
to indicate error case |
@xiaochuanyu LGTM |
Thank you guys! |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
In https://doc.rust-lang.org/rust-by-example/flow_control/match/guard.html, it is stated that:
I was teaching a class today where someone interpreted this sentence as
_
being mandatory when using guard expressions. They were weirded out because of an example where I bound to a variable instead (bc. the guards weren't covering) and didn't know that was possible.The text was updated successfully, but these errors were encountered: