File tree Expand file tree Collapse file tree 1 file changed +2
-0
lines changed
library/std/src/sys/windows Expand file tree Collapse file tree 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> {
2626
2727fn write ( handle_id : c:: DWORD , data : & [ u8 ] ) -> io:: Result < usize > {
2828 let handle = get_handle ( handle_id) ?;
29+ // SAFETY: The handle returned from `get_handle` must be valid and non-null.
2930 let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
3031 ManuallyDrop :: new ( handle) . write ( data)
3132}
@@ -39,6 +40,7 @@ impl Stdin {
3940impl io:: Read for Stdin {
4041 fn read ( & mut self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
4142 let handle = get_handle ( c:: STD_INPUT_HANDLE ) ?;
43+ // SAFETY: The handle returned from `get_handle` must be valid and non-null.
4244 let handle = unsafe { Handle :: from_raw_handle ( handle) } ;
4345 ManuallyDrop :: new ( handle) . read ( buf)
4446 }
You can’t perform that action at this time.
0 commit comments