Don't ICE when evaluating writes to uninhabited enum variants
This commit is contained in:
parent
8cf6c23d66
commit
b71ea80172
5 changed files with 48 additions and 13 deletions
|
|
@ -0,0 +1,28 @@
|
|||
// run-pass
|
||||
|
||||
#![allow(dead_code)]
|
||||
|
||||
enum Empty { }
|
||||
enum Test1 {
|
||||
A(u8),
|
||||
B(Empty),
|
||||
}
|
||||
enum Test2 {
|
||||
A(u8),
|
||||
B(Empty),
|
||||
C,
|
||||
}
|
||||
|
||||
fn bar() -> Option<Empty> {
|
||||
None
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Some(x) = bar() {
|
||||
Test1::B(x);
|
||||
}
|
||||
|
||||
if let Some(x) = bar() {
|
||||
Test2::B(x);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue