File tree 10 files changed +21
-15
lines changed
10 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,7 @@ cfg_unix! {
461
461
462
462
impl From <File > for OwnedFd {
463
463
fn from( val: File ) -> OwnedFd {
464
- self . into_std_file( ) . into( )
464
+ val . into_std_file( ) . into( )
465
465
}
466
466
}
467
467
}
Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ cfg_unix! {
186
186
187
187
impl AsFd for Stderr {
188
188
fn as_fd( & self ) -> BorrowedFd <' _> {
189
- std:: io:: stderr( ) . as_fd( )
189
+ unsafe {
190
+ BorrowedFd :: borrow_raw( std:: io:: stderr( ) . as_raw_fd( ) )
191
+ }
190
192
}
191
193
}
192
194
}
Original file line number Diff line number Diff line change @@ -210,9 +210,11 @@ cfg_unix! {
210
210
cfg_io_safety! {
211
211
use crate :: os:: unix:: io:: { AsFd , BorrowedFd } ;
212
212
213
- impl AsFd for Stderr {
213
+ impl AsFd for Stdin {
214
214
fn as_fd( & self ) -> BorrowedFd <' _> {
215
- std:: io:: stdin( ) . as_fd( )
215
+ unsafe {
216
+ BorrowedFd :: borrow_raw( std:: io:: stdin( ) . as_raw_fd( ) )
217
+ }
216
218
}
217
219
}
218
220
}
Original file line number Diff line number Diff line change @@ -186,7 +186,9 @@ cfg_unix! {
186
186
187
187
impl AsFd for Stdout {
188
188
fn as_fd( & self ) -> BorrowedFd <' _> {
189
- std:: io:: stdout( ) . as_fd( )
189
+ unsafe {
190
+ BorrowedFd :: borrow_raw( std:: io:: stdout( ) . as_raw_fd( ) )
191
+ }
190
192
}
191
193
}
192
194
}
Original file line number Diff line number Diff line change @@ -434,7 +434,7 @@ cfg_unix! {
434
434
435
435
impl From <TcpStream > for OwnedFd {
436
436
fn from( stream: TcpStream ) -> OwnedFd {
437
- stream. watcher. into_inner ( ) . unwrap( ) . into( )
437
+ stream. watcher. get_ref ( ) . try_clone ( ) . unwrap( ) . into( )
438
438
}
439
439
}
440
440
}
Original file line number Diff line number Diff line change @@ -574,7 +574,7 @@ cfg_unix! {
574
574
575
575
impl From <OwnedFd > for UdpSocket {
576
576
fn from( fd: OwnedFd ) -> UdpSocket {
577
- std:: net:: TcpStream :: from( fd) . into( )
577
+ std:: net:: UdpSocket :: from( fd) . into( )
578
578
}
579
579
}
580
580
Original file line number Diff line number Diff line change @@ -352,7 +352,7 @@ cfg_io_safety! {
352
352
353
353
impl From <OwnedFd > for UnixDatagram {
354
354
fn from( fd: OwnedFd ) -> UnixDatagram {
355
- std :: net :: TcpStream :: from( fd) . into( )
355
+ StdUnixDatagram :: from( fd) . into( )
356
356
}
357
357
}
358
358
@@ -361,4 +361,4 @@ cfg_io_safety! {
361
361
stream. watcher. into_inner( ) . unwrap( ) . into( )
362
362
}
363
363
}
364
- }
364
+ }
Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ cfg_io_safety! {
245
245
246
246
impl From <OwnedFd > for UnixListener {
247
247
fn from( fd: OwnedFd ) -> UnixListener {
248
- std:: net:: TcpStream :: from( fd) . into( )
248
+ std:: os :: unix :: net:: UnixListener :: from( fd) . into( )
249
249
}
250
250
}
251
251
@@ -254,4 +254,4 @@ cfg_io_safety! {
254
254
stream. watcher. into_inner( ) . unwrap( ) . into( )
255
255
}
256
256
}
257
- }
257
+ }
Original file line number Diff line number Diff line change @@ -276,13 +276,13 @@ cfg_io_safety! {
276
276
277
277
impl From <OwnedFd > for UnixStream {
278
278
fn from( fd: OwnedFd ) -> UnixStream {
279
- std:: net:: TcpStream :: from( fd) . into( )
279
+ std:: os :: unix :: net:: UnixStream :: from( fd) . into( )
280
280
}
281
281
}
282
282
283
283
impl From <UnixStream > for OwnedFd {
284
284
fn from( stream: UnixStream ) -> OwnedFd {
285
- stream. watcher. into_inner ( ) . unwrap( ) . into( )
285
+ stream. watcher. get_ref ( ) . try_clone ( ) . unwrap( ) . into( )
286
286
}
287
287
}
288
- }
288
+ }
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ macro_rules! cfg_default {
246
246
macro_rules! cfg_io_safety {
247
247
( $( $item: item) * ) => {
248
248
$(
249
- #[ cfg( feature = "io-safety " ) ]
249
+ #[ cfg( feature = "io_safety " ) ]
250
250
$item
251
251
) *
252
252
}
You can’t perform that action at this time.
0 commit comments