File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1777,10 +1777,10 @@ pub fn encode_utf8_raw(code: u32, dst: &mut [u8]) -> &mut [u8] {
1777
1777
dst. len( ) ,
1778
1778
) ;
1779
1779
}
1780
- // SAFETY: it's safe to pretend that the bytes in the slice may be uninitialized
1781
- let dst = unsafe { & mut * ( dst as * mut [ u8 ] as * mut [ MaybeUninit < u8 > ] ) } ;
1782
- // SAFETY: `dst` has been checked to be long enough to hold the encoded codepoint
1783
- unsafe { encode_utf8_raw_unchecked ( code, dst) }
1780
+
1781
+ // SAFETY: `encode_utf8_raw_unchecked` only writes initialized bytes to the slice,
1782
+ // `dst` has been checked to be long enough to hold the encoded codepoint
1783
+ unsafe { encode_utf8_raw_unchecked ( code, & mut * ( dst as * mut [ u8 ] as * mut [ MaybeUninit < u8 > ] ) ) }
1784
1784
}
1785
1785
1786
1786
/// Encodes a raw u32 value as UTF-8 into the provided possibly uninitialized byte buffer,
You can’t perform that action at this time.
0 commit comments