Skip to content

Commit

Permalink
Make impl<Fd: AsFd> impl take ?Sized
Browse files Browse the repository at this point in the history
  • Loading branch information
nbdd0121 committed Nov 17, 2023
1 parent 4d7f952 commit 9968519
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions library/std/src/os/fd/owned.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,15 @@ pub trait AsFd {
}

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

#[stable(feature = "io_safety", since = "1.63.0")]
impl<T: AsFd> AsFd for &mut T {
impl<T: AsFd + ?Sized> AsFd for &mut T {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
T::as_fd(self)
Expand Down Expand Up @@ -396,23 +396,23 @@ impl From<OwnedFd> for crate::net::UdpSocket {
/// impl MyTrait for Box<UdpSocket> {}
/// # }
/// ```
impl<T: AsFd> AsFd for crate::sync::Arc<T> {
impl<T: AsFd + ?Sized> AsFd for crate::sync::Arc<T> {
#[inline]
fn as_fd(&self) -> BorrowedFd<'_> {
(**self).as_fd()
}
}

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

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

0 comments on commit 9968519

Please sign in to comment.