add empty enum to the test cases
This commit is contained in:
@@ -20,6 +20,8 @@ struct Foo {
|
|||||||
y: !,
|
y: !,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum Bar {}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
unsafe {
|
unsafe {
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
@@ -57,5 +59,23 @@ fn main() {
|
|||||||
})),
|
})),
|
||||||
Some(true)
|
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)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user