-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guards example may be confusing #1539
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! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in 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: