We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1ef5dbe commit f311db1Copy full SHA for f311db1
library/core/tests/mem.rs
@@ -129,3 +129,21 @@ fn test_discriminant_send_sync() {
129
is_send_sync::<Discriminant<Regular>>();
130
is_send_sync::<Discriminant<NotSendSync>>();
131
}
132
+
133
+#[test]
134
+fn assume_init_good() {
135
+ const TRUE: bool = {
136
+ let mut x = MaybeUninit::<bool>::uninit();
137
+ x.as_mut_ptr().write(true);
138
+ x.assume_init()
139
+ };
140
+ assert!(TRUE);
141
+}
142
143
144
+#[should_panic]
145
+fn assume_init_bad() {
146
+ const BAD: () = {
147
+ MaybeUninit::<!>::uninit().assume_init();
148
149
0 commit comments