Skip to content

Commit 5b6d30a

Browse files
authored
Rollup merge of #114655 - nbdd0121:io-safety, r=dtolnay
Make `impl<Fd: AsFd>` impl take `?Sized` `@rustbot` labels: +T-libs-api +needs-fcp
2 parents 0a8ea93 + f4aeb70 commit 5b6d30a

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

library/std/src/os/fd/owned.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -244,15 +244,15 @@ pub trait AsFd {
244244
}
245245

246246
#[stable(feature = "io_safety", since = "1.63.0")]
247-
impl<T: AsFd> AsFd for &T {
247+
impl<T: AsFd + ?Sized> AsFd for &T {
248248
#[inline]
249249
fn as_fd(&self) -> BorrowedFd<'_> {
250250
T::as_fd(self)
251251
}
252252
}
253253

254254
#[stable(feature = "io_safety", since = "1.63.0")]
255-
impl<T: AsFd> AsFd for &mut T {
255+
impl<T: AsFd + ?Sized> AsFd for &mut T {
256256
#[inline]
257257
fn as_fd(&self) -> BorrowedFd<'_> {
258258
T::as_fd(self)
@@ -402,23 +402,23 @@ impl From<OwnedFd> for crate::net::UdpSocket {
402402
/// impl MyTrait for Box<UdpSocket> {}
403403
/// # }
404404
/// ```
405-
impl<T: AsFd> AsFd for crate::sync::Arc<T> {
405+
impl<T: AsFd + ?Sized> AsFd for crate::sync::Arc<T> {
406406
#[inline]
407407
fn as_fd(&self) -> BorrowedFd<'_> {
408408
(**self).as_fd()
409409
}
410410
}
411411

412412
#[stable(feature = "asfd_rc", since = "1.69.0")]
413-
impl<T: AsFd> AsFd for crate::rc::Rc<T> {
413+
impl<T: AsFd + ?Sized> AsFd for crate::rc::Rc<T> {
414414
#[inline]
415415
fn as_fd(&self) -> BorrowedFd<'_> {
416416
(**self).as_fd()
417417
}
418418
}
419419

420420
#[stable(feature = "asfd_ptrs", since = "1.64.0")]
421-
impl<T: AsFd> AsFd for Box<T> {
421+
impl<T: AsFd + ?Sized> AsFd for Box<T> {
422422
#[inline]
423423
fn as_fd(&self) -> BorrowedFd<'_> {
424424
(**self).as_fd()

library/std/src/os/windows/io/handle.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -422,15 +422,15 @@ pub trait AsHandle {
422422
}
423423

424424
#[stable(feature = "io_safety", since = "1.63.0")]
425-
impl<T: AsHandle> AsHandle for &T {
425+
impl<T: AsHandle + ?Sized> AsHandle for &T {
426426
#[inline]
427427
fn as_handle(&self) -> BorrowedHandle<'_> {
428428
T::as_handle(self)
429429
}
430430
}
431431

432432
#[stable(feature = "io_safety", since = "1.63.0")]
433-
impl<T: AsHandle> AsHandle for &mut T {
433+
impl<T: AsHandle + ?Sized> AsHandle for &mut T {
434434
#[inline]
435435
fn as_handle(&self) -> BorrowedHandle<'_> {
436436
T::as_handle(self)
@@ -450,23 +450,23 @@ impl<T: AsHandle> AsHandle for &mut T {
450450
/// impl MyTrait for Box<File> {}
451451
/// # }
452452
/// ```
453-
impl<T: AsHandle> AsHandle for crate::sync::Arc<T> {
453+
impl<T: AsHandle + ?Sized> AsHandle for crate::sync::Arc<T> {
454454
#[inline]
455455
fn as_handle(&self) -> BorrowedHandle<'_> {
456456
(**self).as_handle()
457457
}
458458
}
459459

460460
#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
461-
impl<T: AsHandle> AsHandle for crate::rc::Rc<T> {
461+
impl<T: AsHandle + ?Sized> AsHandle for crate::rc::Rc<T> {
462462
#[inline]
463463
fn as_handle(&self) -> BorrowedHandle<'_> {
464464
(**self).as_handle()
465465
}
466466
}
467467

468468
#[stable(feature = "as_windows_ptrs", since = "1.71.0")]
469-
impl<T: AsHandle> AsHandle for Box<T> {
469+
impl<T: AsHandle + ?Sized> AsHandle for Box<T> {
470470
#[inline]
471471
fn as_handle(&self) -> BorrowedHandle<'_> {
472472
(**self).as_handle()

0 commit comments

Comments
 (0)