Skip to content

Commit 9c1b7ae

Browse files
committed
Revert "Implement AsRawFd/IntoRawFd for RawFd"
This reverts commit 2cf686f (#40842) RawFd is a type alias for c_int, which is itself a type alias for i32. As a result, adding AsRawFd and IntoRawFd impls for RawFd actually adds them for i32. As a result, the reverted commit makes this valid: ``` use std::os::unix::io::AsRawFd; fn arf<T: AsRawFd>(_: T) {} fn main() { arf(32i32) } ``` Implimenting AsRawFd and IntoRawFd for i32 breaks the promises of both those traits that their methods return a valid RawFd. r? @aturon cc @Mic92 @kamalmarhubi
1 parent 5309a3e commit 9c1b7ae

File tree

1 file changed

+0
-15
lines changed
  • src/libstd/sys/unix/ext

1 file changed

+0
-15
lines changed

src/libstd/sys/unix/ext/io.rs

-15
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,6 @@ pub trait IntoRawFd {
7272
fn into_raw_fd(self) -> RawFd;
7373
}
7474

75-
#[stable(feature = "rust1", since = "1.0.0")]
76-
impl AsRawFd for RawFd {
77-
fn as_raw_fd(&self) -> RawFd {
78-
*self
79-
}
80-
}
81-
8275
#[stable(feature = "rust1", since = "1.0.0")]
8376
impl AsRawFd for fs::File {
8477
fn as_raw_fd(&self) -> RawFd {
@@ -91,14 +84,6 @@ impl FromRawFd for fs::File {
9184
fs::File::from_inner(sys::fs::File::from_inner(fd))
9285
}
9386
}
94-
95-
#[stable(feature = "into_raw_os", since = "1.4.0")]
96-
impl IntoRawFd for RawFd {
97-
fn into_raw_fd(self) -> RawFd {
98-
self
99-
}
100-
}
101-
10287
#[stable(feature = "into_raw_os", since = "1.4.0")]
10388
impl IntoRawFd for fs::File {
10489
fn into_raw_fd(self) -> RawFd {

0 commit comments

Comments
 (0)