File tree 2 files changed +5
-4
lines changed
library/std/src/sys/windows
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ impl File {
357
357
let mut info: c:: FILE_BASIC_INFO = mem:: zeroed ( ) ;
358
358
let size = mem:: size_of_val ( & info) ;
359
359
cvt ( c:: GetFileInformationByHandleEx (
360
- self . handle . raw ( ) ,
360
+ self . handle . as_raw_handle ( ) ,
361
361
c:: FileBasicInfo ,
362
362
& mut info as * mut _ as * mut libc:: c_void ,
363
363
size as c:: DWORD ,
@@ -385,7 +385,7 @@ impl File {
385
385
let mut info: c:: FILE_STANDARD_INFO = mem:: zeroed ( ) ;
386
386
let size = mem:: size_of_val ( & info) ;
387
387
cvt ( c:: GetFileInformationByHandleEx (
388
- self . handle . raw ( ) ,
388
+ self . handle . as_raw_handle ( ) ,
389
389
c:: FileStandardInfo ,
390
390
& mut info as * mut _ as * mut libc:: c_void ,
391
391
size as c:: DWORD ,
Original file line number Diff line number Diff line change 2
2
3
3
use crate :: io;
4
4
use crate :: mem:: ManuallyDrop ;
5
+ use crate :: os:: windows:: io:: FromRawHandle ;
5
6
use crate :: sys:: c;
6
7
use crate :: sys:: handle:: Handle ;
7
8
@@ -25,7 +26,7 @@ pub fn get_handle(handle_id: c::DWORD) -> io::Result<c::HANDLE> {
25
26
26
27
fn write ( handle_id : c:: DWORD , data : & [ u8 ] ) -> io:: Result < usize > {
27
28
let handle = get_handle ( handle_id) ?;
28
- let handle = Handle :: new ( handle) ;
29
+ let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
29
30
ManuallyDrop :: new ( handle) . write ( data)
30
31
}
31
32
@@ -38,7 +39,7 @@ impl Stdin {
38
39
impl io:: Read for Stdin {
39
40
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
40
41
let handle = get_handle ( c:: STD_INPUT_HANDLE ) ?;
41
- let handle = Handle :: new ( handle) ;
42
+ let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
42
43
ManuallyDrop :: new ( handle) . read ( buf)
43
44
}
44
45
}
You can’t perform that action at this time.
0 commit comments