File tree 1 file changed +2
-0
lines changed
library/std/src/sys/windows
1 file changed +2
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ pub fn get_handle(handle_id: c::DWORD) -> io::Result<c::HANDLE> {
26
26
27
27
fn write ( handle_id : c:: DWORD , data : & [ u8 ] ) -> io:: Result < usize > {
28
28
let handle = get_handle ( handle_id) ?;
29
+ // SAFETY: The handle returned from `get_handle` must be valid and non-null.
29
30
let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
30
31
ManuallyDrop :: new ( handle) . write ( data)
31
32
}
@@ -39,6 +40,7 @@ impl Stdin {
39
40
impl io:: Read for Stdin {
40
41
fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
41
42
let handle = get_handle ( c:: STD_INPUT_HANDLE ) ?;
43
+ // SAFETY: The handle returned from `get_handle` must be valid and non-null.
42
44
let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
43
45
ManuallyDrop :: new ( handle) . read ( buf)
44
46
}
You can’t perform that action at this time.
0 commit comments