File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -357,7 +357,7 @@ impl File {
357357 let mut info: c:: FILE_BASIC_INFO = mem:: zeroed ( ) ;
358358 let size = mem:: size_of_val ( & info) ;
359359 cvt ( c:: GetFileInformationByHandleEx (
360- self . handle . raw ( ) ,
360+ self . handle . as_raw_handle ( ) ,
361361 c:: FileBasicInfo ,
362362 & mut info as * mut _ as * mut libc:: c_void ,
363363 size as c:: DWORD ,
@@ -385,7 +385,7 @@ impl File {
385385 let mut info: c:: FILE_STANDARD_INFO = mem:: zeroed ( ) ;
386386 let size = mem:: size_of_val ( & info) ;
387387 cvt ( c:: GetFileInformationByHandleEx (
388- self . handle . raw ( ) ,
388+ self . handle . as_raw_handle ( ) ,
389389 c:: FileStandardInfo ,
390390 & mut info as * mut _ as * mut libc:: c_void ,
391391 size as c:: DWORD ,
Original file line number Diff line number Diff line change 22
33use crate :: io;
44use crate :: mem:: ManuallyDrop ;
5+ use crate :: os:: windows:: io:: FromRawHandle ;
56use crate :: sys:: c;
67use crate :: sys:: handle:: Handle ;
78
@@ -25,7 +26,7 @@ pub fn get_handle(handle_id: c::DWORD) -> io::Result<c::HANDLE> {
2526
2627fn write ( handle_id : c:: DWORD , data : & [ u8 ] ) -> io:: Result < usize > {
2728 let handle = get_handle ( handle_id) ?;
28- let handle = Handle :: new ( handle) ;
29+ let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
2930 ManuallyDrop :: new ( handle) . write ( data)
3031}
3132
@@ -38,7 +39,7 @@ impl Stdin {
3839impl io:: Read for Stdin {
3940 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
4041 let handle = get_handle ( c:: STD_INPUT_HANDLE ) ?;
41- let handle = Handle :: new ( handle) ;
42+ let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
4243 ManuallyDrop :: new ( handle) . read ( buf)
4344 }
4445}
You can’t perform that action at this time.
0 commit comments