@@ -170,7 +170,7 @@ fn write(
170
170
}
171
171
172
172
fn write_valid_utf8_to_console ( handle : c:: HANDLE , utf8 : & str ) -> io:: Result < usize > {
173
- let mut utf16: [ MaybeUninit < u16 > ; MAX_BUFFER_SIZE / 2 ] = MaybeUninit :: uninit_array ( ) ;
173
+ let mut utf16 = [ MaybeUninit :: < u16 > :: uninit ( ) ; MAX_BUFFER_SIZE / 2 ] ;
174
174
let mut len_utf16 = 0 ;
175
175
for ( chr, dest) in utf8. encode_utf16 ( ) . zip ( utf16. iter_mut ( ) ) {
176
176
* dest = MaybeUninit :: new ( chr) ;
@@ -252,7 +252,7 @@ impl io::Read for Stdin {
252
252
return Ok ( bytes_copied) ;
253
253
} else if buf. len ( ) - bytes_copied < 4 {
254
254
// Not enough space to get a UTF-8 byte. We will use the incomplete UTF8.
255
- let mut utf16_buf = [ MaybeUninit :: new ( 1 ) ; 1 ] ;
255
+ let mut utf16_buf = [ MaybeUninit :: new ( 0 ) ; 1 ] ;
256
256
// Read one u16 character.
257
257
let read = read_u16s_fixup_surrogates ( handle, & mut utf16_buf, 1 , & mut self . surrogate ) ?;
258
258
// Read bytes, using the (now-empty) self.incomplete_utf8 as extra space.
@@ -267,8 +267,8 @@ impl io::Read for Stdin {
267
267
bytes_copied += self . incomplete_utf8 . read ( & mut buf[ bytes_copied..] ) ;
268
268
Ok ( bytes_copied)
269
269
} else {
270
- let mut utf16_buf: [ MaybeUninit < u16 > ; MAX_BUFFER_SIZE / 2 ] =
271
- MaybeUninit :: uninit_array ( ) ;
270
+ let mut utf16_buf = [ MaybeUninit :: < u16 > :: uninit ( ) ; MAX_BUFFER_SIZE / 2 ] ;
271
+
272
272
// In the worst case, a UTF-8 string can take 3 bytes for every `u16` of a UTF-16. So
273
273
// we can read at most a third of `buf.len()` chars and uphold the guarantee no data gets
274
274
// lost.
0 commit comments