Skip to content

Commit a478b83

Browse files
Rollup merge of rust-lang#107317 - ids1024:asfd-rc, r=dtolnay
Implement `AsFd` and `AsRawFd` for `Rc` Fixes rust-lang#105931.
2 parents 575d424 + c13669e commit a478b83

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,14 @@ impl<T: AsFd> AsFd for crate::sync::Arc<T> {
396396
}
397397
}
398398

399+
#[stable(feature = "asfd_rc", since = "CURRENT_RUSTC_VERSION")]
400+
impl<T: AsFd> AsFd for crate::rc::Rc<T> {
401+
#[inline]
402+
fn as_fd(&self) -> BorrowedFd<'_> {
403+
(**self).as_fd()
404+
}
405+
}
406+
399407
#[stable(feature = "asfd_ptrs", since = "1.64.0")]
400408
impl<T: AsFd> AsFd for Box<T> {
401409
#[inline]

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

+8
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ impl<T: AsRawFd> AsRawFd for crate::sync::Arc<T> {
244244
}
245245
}
246246

247+
#[stable(feature = "asfd_rc", since = "CURRENT_RUSTC_VERSION")]
248+
impl<T: AsRawFd> AsRawFd for crate::rc::Rc<T> {
249+
#[inline]
250+
fn as_raw_fd(&self) -> RawFd {
251+
(**self).as_raw_fd()
252+
}
253+
}
254+
247255
#[stable(feature = "asrawfd_ptrs", since = "1.63.0")]
248256
impl<T: AsRawFd> AsRawFd for Box<T> {
249257
#[inline]

0 commit comments

Comments
 (0)