Merge pull request #445 from Nadrieril/Nadrieril-patch-1

Stabilize `min_exhaustive_patterns`
pull/459/head
Eric Huss 3 months ago committed by GitHub
commit 6ecf95c5f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -137,9 +137,9 @@ because the `Err` case doesn't actually exist (strictly speaking, this is only
an optimization that is not guaranteed, so for example transmuting one into the
other is still Undefined Behavior).
The following *could* also compile:
The following also compiles:
```rust,compile_fail
```rust
enum Void {}
let res: Result<u32, Void> = Ok(0);
@ -148,8 +148,6 @@ let res: Result<u32, Void> = Ok(0);
let Ok(num) = res;
```
But this trick doesn't work yet.
One final subtle detail about empty types is that raw pointers to them are
actually valid to construct, but dereferencing them is Undefined Behavior
because that wouldn't make sense.

Loading…
Cancel
Save