Commit fba5e6a 1 parent 795f027 commit fba5e6a Copy full SHA for fba5e6a
File tree 1 file changed +6
-6
lines changed
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -308,10 +308,10 @@ impl EnumDescriptor {
308
308
309
309
use std:: mem;
310
310
unsafe {
311
- let mut r = mem:: uninitialized ( ) ;
311
+ let mut r = mem:: MaybeUninit :: < E > :: uninit ( ) ;
312
312
self . get_descriptor
313
- . copy_to ( value, & mut r as * mut E as * mut ( ) ) ;
314
- Some ( r)
313
+ . copy_to ( value, r . as_mut_ptr ( ) as * mut ( ) ) ;
314
+ Some ( r. assume_init ( ) )
315
315
}
316
316
}
317
317
@@ -337,9 +337,9 @@ impl EnumDescriptor {
337
337
debug_assert_eq ! ( mem:: size_of:: <E >( ) , mem:: size_of:: <i32 >( ) ) ;
338
338
unsafe {
339
339
// This works because `ProtobufEnumOrUnknown<E>` is `#[repr(transparent)]`
340
- let mut r = mem:: uninitialized ( ) ;
341
- ptr:: copy ( & value, & mut r as * mut E as * mut i32 , 1 ) ;
342
- Some ( r)
340
+ let mut r = mem:: MaybeUninit :: < E > :: uninit ( ) ;
341
+ ptr:: copy ( & value, r . as_mut_ptr ( ) as * mut i32 , 1 ) ;
342
+ Some ( r. assume_init ( ) )
343
343
}
344
344
}
345
345
}
You can’t perform that action at this time.
0 commit comments