File tree Expand file tree Collapse file tree 10 files changed +21
-15
lines changed Expand file tree Collapse file tree 10 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,7 @@ cfg_unix! {
461461
462462 impl From <File > for OwnedFd {
463463 fn from( val: File ) -> OwnedFd {
464- self . into_std_file( ) . into( )
464+ val . into_std_file( ) . into( )
465465 }
466466 }
467467 }
Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ cfg_unix! {
186186
187187 impl AsFd for Stderr {
188188 fn as_fd( & self ) -> BorrowedFd <' _> {
189- std:: io:: stderr( ) . as_fd( )
189+ unsafe {
190+ BorrowedFd :: borrow_raw( std:: io:: stderr( ) . as_raw_fd( ) )
191+ }
190192 }
191193 }
192194 }
Original file line number Diff line number Diff line change @@ -210,9 +210,11 @@ cfg_unix! {
210210 cfg_io_safety! {
211211 use crate :: os:: unix:: io:: { AsFd , BorrowedFd } ;
212212
213- impl AsFd for Stderr {
213+ impl AsFd for Stdin {
214214 fn as_fd( & self ) -> BorrowedFd <' _> {
215- std:: io:: stdin( ) . as_fd( )
215+ unsafe {
216+ BorrowedFd :: borrow_raw( std:: io:: stdin( ) . as_raw_fd( ) )
217+ }
216218 }
217219 }
218220 }
Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ cfg_unix! {
186186
187187 impl AsFd for Stdout {
188188 fn as_fd( & self ) -> BorrowedFd <' _> {
189- std:: io:: stdout( ) . as_fd( )
189+ unsafe {
190+ BorrowedFd :: borrow_raw( std:: io:: stdout( ) . as_raw_fd( ) )
191+ }
190192 }
191193 }
192194 }
Original file line number Diff line number Diff line change @@ -434,7 +434,7 @@ cfg_unix! {
434434
435435 impl From <TcpStream > for OwnedFd {
436436 fn from( stream: TcpStream ) -> OwnedFd {
437- stream. watcher. into_inner ( ) . unwrap( ) . into( )
437+ stream. watcher. get_ref ( ) . try_clone ( ) . unwrap( ) . into( )
438438 }
439439 }
440440 }
Original file line number Diff line number Diff line change @@ -574,7 +574,7 @@ cfg_unix! {
574574
575575 impl From <OwnedFd > for UdpSocket {
576576 fn from( fd: OwnedFd ) -> UdpSocket {
577- std:: net:: TcpStream :: from( fd) . into( )
577+ std:: net:: UdpSocket :: from( fd) . into( )
578578 }
579579 }
580580
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ cfg_io_safety! {
352352
353353 impl From <OwnedFd > for UnixDatagram {
354354 fn from( fd: OwnedFd ) -> UnixDatagram {
355- std :: net :: TcpStream :: from( fd) . into( )
355+ StdUnixDatagram :: from( fd) . into( )
356356 }
357357 }
358358
@@ -361,4 +361,4 @@ cfg_io_safety! {
361361 stream. watcher. into_inner( ) . unwrap( ) . into( )
362362 }
363363 }
364- }
364+ }
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ cfg_io_safety! {
245245
246246 impl From <OwnedFd > for UnixListener {
247247 fn from( fd: OwnedFd ) -> UnixListener {
248- std:: net:: TcpStream :: from( fd) . into( )
248+ std:: os :: unix :: net:: UnixListener :: from( fd) . into( )
249249 }
250250 }
251251
@@ -254,4 +254,4 @@ cfg_io_safety! {
254254 stream. watcher. into_inner( ) . unwrap( ) . into( )
255255 }
256256 }
257- }
257+ }
Original file line number Diff line number Diff line change @@ -276,13 +276,13 @@ cfg_io_safety! {
276276
277277 impl From <OwnedFd > for UnixStream {
278278 fn from( fd: OwnedFd ) -> UnixStream {
279- std:: net:: TcpStream :: from( fd) . into( )
279+ std:: os :: unix :: net:: UnixStream :: from( fd) . into( )
280280 }
281281 }
282282
283283 impl From <UnixStream > for OwnedFd {
284284 fn from( stream: UnixStream ) -> OwnedFd {
285- stream. watcher. into_inner ( ) . unwrap( ) . into( )
285+ stream. watcher. get_ref ( ) . try_clone ( ) . unwrap( ) . into( )
286286 }
287287 }
288- }
288+ }
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ macro_rules! cfg_default {
246246macro_rules! cfg_io_safety {
247247 ( $( $item: item) * ) => {
248248 $(
249- #[ cfg( feature = "io-safety " ) ]
249+ #[ cfg( feature = "io_safety " ) ]
250250 $item
251251 ) *
252252 }
You can’t perform that action at this time.
0 commit comments