Skip to content

Commit 1774374

Browse files
committedJan 26, 2023
Implement AsFd and AsRawFd for Rc
Fixes rust-lang/rust#105931.
1 parent 60bfe32 commit 1774374

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
 

‎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]

‎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)
Please sign in to comment.