File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ pub unsafe fn to_enum<T: Enum>(v: u8) -> Option<T> {
95
95
if v >= T :: max_value ( ) {
96
96
None
97
97
} else {
98
- let mut target: T = std:: mem:: MaybeUninit :: uninit ( ) . assume_init ( ) ;
98
+ let mut target: T = std:: mem:: zeroed ( ) ;
99
99
std:: ptr:: copy_nonoverlapping ( & v as * const u8 , & mut target as * mut T as * mut u8 , 1 ) ;
100
100
Some ( target)
101
101
}
@@ -106,7 +106,7 @@ pub unsafe fn to_enum<T: Enum>(v: u8) -> Option<T> {
106
106
/// This method is safe to call if the length of v is sizeof(T)
107
107
/// and the bit pattern described by v is a valid state for T
108
108
pub unsafe fn to_pod < T : Pod > ( v : & [ u8 ] ) -> T {
109
- let mut target: T = std:: mem:: MaybeUninit :: uninit ( ) . assume_init ( ) ;
109
+ let mut target: T = std:: mem:: zeroed ( ) ;
110
110
std:: ptr:: copy_nonoverlapping (
111
111
v. as_ptr ( ) ,
112
112
& mut target as * mut T as * mut u8 ,
You can’t perform that action at this time.
0 commit comments