We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d6f8504 commit 0f28009Copy full SHA for 0f28009
src/test/run-pass/panic-uninitialized-zeroed.rs
@@ -20,6 +20,8 @@ struct Foo {
20
y: !,
21
}
22
23
+enum Bar {}
24
+
25
fn main() {
26
unsafe {
27
assert_eq!(
@@ -57,5 +59,23 @@ fn main() {
57
59
})),
58
60
Some(true)
61
);
62
63
+ assert_eq!(
64
+ panic::catch_unwind(|| {
65
+ mem::uninitialized::<Bar>()
66
+ }).err().and_then(|a| a.downcast_ref::<String>().map(|s| {
67
+ s == "Attempted to instantiate uninhabited type Bar using mem::uninitialized"
68
+ })),
69
+ Some(true)
70
+ );
71
72
73
74
+ mem::zeroed::<Bar>()
75
76
+ s == "Attempted to instantiate uninhabited type Bar using mem::zeroed"
77
78
79
80
81
0 commit comments