diff options
| author | Michael Goulet <michael@errs.io> | 2023-02-08 20:01:24 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-08 20:01:24 -0800 |
| commit | a478b836fa8ba8691e7c57744049eda1c9d3b8c2 (patch) | |
| tree | 66c99c07bd462bf6cf66977666ea5301a39b5f75 | |
| parent | 575d424c94e0d4feea8cf4fcf04d47b83f28eaef (diff) | |
| parent | c13669e00b4ba3f353ea1cfa825aecb0bb765f9c (diff) | |
| download | rust-a478b836fa8ba8691e7c57744049eda1c9d3b8c2.tar.gz rust-a478b836fa8ba8691e7c57744049eda1c9d3b8c2.zip | |
Rollup merge of #107317 - ids1024:asfd-rc, r=dtolnay
Implement `AsFd` and `AsRawFd` for `Rc` Fixes https://github.com/rust-lang/rust/issues/105931.
| -rw-r--r-- | library/std/src/os/fd/owned.rs | 8 | ||||
| -rw-r--r-- | library/std/src/os/fd/raw.rs | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/library/std/src/os/fd/owned.rs b/library/std/src/os/fd/owned.rs index c41e093a7e5..439b8d52a2d 100644 --- a/library/std/src/os/fd/owned.rs +++ b/library/std/src/os/fd/owned.rs @@ -396,6 +396,14 @@ impl<T: AsFd> AsFd for crate::sync::Arc<T> { } } +#[stable(feature = "asfd_rc", since = "CURRENT_RUSTC_VERSION")] +impl<T: AsFd> 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> { #[inline] diff --git a/library/std/src/os/fd/raw.rs b/library/std/src/os/fd/raw.rs index f92a0506670..c138162f1ab 100644 --- a/library/std/src/os/fd/raw.rs +++ b/library/std/src/os/fd/raw.rs @@ -244,6 +244,14 @@ impl<T: AsRawFd> AsRawFd for crate::sync::Arc<T> { } } +#[stable(feature = "asfd_rc", since = "CURRENT_RUSTC_VERSION")] +impl<T: AsRawFd> AsRawFd for crate::rc::Rc<T> { + #[inline] + fn as_raw_fd(&self) -> RawFd { + (**self).as_raw_fd() + } +} + #[stable(feature = "asrawfd_ptrs", since = "1.63.0")] impl<T: AsRawFd> AsRawFd for Box<T> { #[inline] |
