add empty enum to the test cases
This commit is contained in:
parent
d864edc349
commit
758ce16b3d
1 changed files with 20 additions and 0 deletions
|
@ -20,6 +20,8 @@ struct Foo {
|
|||
y: !,
|
||||
}
|
||||
|
||||
enum Bar {}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
assert_eq!(
|
||||
|
@ -57,5 +59,23 @@ fn main() {
|
|||
})),
|
||||
Some(true)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
panic::catch_unwind(|| {
|
||||
mem::uninitialized::<Bar>()
|
||||
}).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
|
||||
s == "Attempted to instantiate uninhabited type Bar using mem::uninitialized"
|
||||
})),
|
||||
Some(true)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
panic::catch_unwind(|| {
|
||||
mem::zeroed::<Bar>()
|
||||
}).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
|
||||
s == "Attempted to instantiate uninhabited type Bar using mem::zeroed"
|
||||
})),
|
||||
Some(true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue