Skip to content

Commit 5105b1e

Browse files
committed
Auto merge of #116057 - RalfJung:io-safety, r=Mark-Simulacrum
fix OS-specific I/O safety docs since the io_safety feature is stable Looks like this text was forgotten to be updated when `io_safety` got stabilized: it still says "once the io_safety feature is stable". Also adjust the wording a bit for how these docs relate to the general concept of I/O safety.
2 parents 91958e0 + 813fed2 commit 5105b1e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

library/std/src/os/unix/io/mod.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
//!
77
//! This module provides three types for representing file descriptors,
88
//! with different ownership properties: raw, borrowed, and owned, which are
9-
//! analogous to types used for representing pointers. These types reflect the Unix version of [I/O safety].
9+
//! analogous to types used for representing pointers. These types reflect concepts of [I/O
10+
//! safety][io-safety] on Unix.
1011
//!
1112
//! | Type | Analogous to |
1213
//! | ------------------ | ------------ |
@@ -17,8 +18,8 @@
1718
//! Like raw pointers, `RawFd` values are primitive values. And in new code,
1819
//! they should be considered unsafe to do I/O on (analogous to dereferencing
1920
//! them). Rust did not always provide this guidance, so existing code in the
20-
//! Rust ecosystem often doesn't mark `RawFd` usage as unsafe. Once the
21-
//! `io_safety` feature is stable, libraries will be encouraged to migrate,
21+
//! Rust ecosystem often doesn't mark `RawFd` usage as unsafe.
22+
//! Libraries are encouraged to migrate,
2223
//! either by adding `unsafe` to APIs that dereference `RawFd` values, or by
2324
//! using to `BorrowedFd` or `OwnedFd` instead.
2425
//!
@@ -54,6 +55,8 @@
5455
//! Like boxes, `OwnedFd` values conceptually own the resource they point to,
5556
//! and free (close) it when they are dropped.
5657
//!
58+
//! See the [`io` module docs][io-safety] for a general explanation of I/O safety.
59+
//!
5760
//! ## `/proc/self/mem` and similar OS features
5861
//!
5962
//! Some platforms have special files, such as `/proc/self/mem`, which
@@ -74,7 +77,7 @@
7477
//! necessary to use *sandboxing*, which is outside the scope of `std`.
7578
//!
7679
//! [`BorrowedFd<'a>`]: crate::os::unix::io::BorrowedFd
77-
//! [I/O safety]: crate::io#io-safety
80+
//! [io-safety]: crate::io#io-safety
7881
7982
#![stable(feature = "rust1", since = "1.0.0")]
8083

library/std/src/os/windows/io/mod.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
//!
77
//! This module provides three types for representing raw handles and sockets
88
//! with different ownership properties: raw, borrowed, and owned, which are
9-
//! analogous to types used for representing pointers. These types reflect the Windows version of [I/O safety].
9+
//! analogous to types used for representing pointers. These types reflect concepts of [I/O
10+
//! safety][io-safety] on Windows.
1011
//!
1112
//! | Type | Analogous to |
1213
//! | ---------------------- | ------------ |
@@ -23,8 +24,8 @@
2324
//! And in new code, they should be considered unsafe to do I/O on (analogous
2425
//! to dereferencing them). Rust did not always provide this guidance, so
2526
//! existing code in the Rust ecosystem often doesn't mark `RawHandle` and
26-
//! `RawSocket` usage as unsafe. Once the `io_safety` feature is stable,
27-
//! libraries will be encouraged to migrate, either by adding `unsafe` to APIs
27+
//! `RawSocket` usage as unsafe.
28+
//! Libraries are encouraged to migrate, either by adding `unsafe` to APIs
2829
//! that dereference `RawHandle` and `RawSocket` values, or by using to
2930
//! `BorrowedHandle`, `BorrowedSocket`, `OwnedHandle`, or `OwnedSocket`.
3031
//!
@@ -45,9 +46,11 @@
4546
//! Like boxes, `OwnedHandle` and `OwnedSocket` values conceptually own the
4647
//! resource they point to, and free (close) it when they are dropped.
4748
//!
49+
//! See the [`io` module docs][io-safety] for a general explanation of I/O safety.
50+
//!
4851
//! [`BorrowedHandle<'a>`]: crate::os::windows::io::BorrowedHandle
4952
//! [`BorrowedSocket<'a>`]: crate::os::windows::io::BorrowedSocket
50-
//! [I/O safety]: crate::io#io-safety
53+
//! [io-safety]: crate::io#io-safety
5154
5255
#![stable(feature = "rust1", since = "1.0.0")]
5356

0 commit comments

Comments
 (0)