-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
non-exhaustive patterns: type ! is non-empty #36011
Comments
Related to #35162 ( |
This function here is the one that checks whether a type is empty but it currently only works on empty enums. I tried to extend it to also handle |
That seems a bit unfortunate, but I understand it might not be a trivial change. So to safely unwrap a match res {
Ok(v) => v,
Err(e) => e,
} |
Yes, that's how you have to do it. |
I'm not sure whether it's me or the code, but I cannot reproduce this, since I can't figure out a way to get
|
@Mark-Simulacrum A way to do it is |
Hi!
I'm trying out
feature(never_type)
and getting an error on the simplest example possible.Rustc is
rustc 1.13.0-nightly (3c5a0fa45 2016-08-22)
onx86_64-pc-windows-msvc
.The code:
And the error I get:
Which is quite bad, as the point of
!
is that it is empty.If I replace it with an empty enum, it works. (It errors on the uninitialized variable, but that's not the point.)
The text was updated successfully, but these errors were encountered: