mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
fix OS-specific I/O safety docs since the io_safety feature is stable
This commit is contained in:
parent
5a4e47ebed
commit
813fed2904
@ -6,7 +6,8 @@
|
|||||||
//!
|
//!
|
||||||
//! This module provides three types for representing file descriptors,
|
//! This module provides three types for representing file descriptors,
|
||||||
//! with different ownership properties: raw, borrowed, and owned, which are
|
//! with different ownership properties: raw, borrowed, and owned, which are
|
||||||
//! analogous to types used for representing pointers. These types reflect the Unix version of [I/O safety].
|
//! analogous to types used for representing pointers. These types reflect concepts of [I/O
|
||||||
|
//! safety][io-safety] on Unix.
|
||||||
//!
|
//!
|
||||||
//! | Type | Analogous to |
|
//! | Type | Analogous to |
|
||||||
//! | ------------------ | ------------ |
|
//! | ------------------ | ------------ |
|
||||||
@ -17,8 +18,8 @@
|
|||||||
//! Like raw pointers, `RawFd` values are primitive values. And in new code,
|
//! Like raw pointers, `RawFd` values are primitive values. And in new code,
|
||||||
//! they should be considered unsafe to do I/O on (analogous to dereferencing
|
//! they should be considered unsafe to do I/O on (analogous to dereferencing
|
||||||
//! them). Rust did not always provide this guidance, so existing code in the
|
//! them). Rust did not always provide this guidance, so existing code in the
|
||||||
//! Rust ecosystem often doesn't mark `RawFd` usage as unsafe. Once the
|
//! Rust ecosystem often doesn't mark `RawFd` usage as unsafe.
|
||||||
//! `io_safety` feature is stable, libraries will be encouraged to migrate,
|
//! Libraries are encouraged to migrate,
|
||||||
//! either by adding `unsafe` to APIs that dereference `RawFd` values, or by
|
//! either by adding `unsafe` to APIs that dereference `RawFd` values, or by
|
||||||
//! using to `BorrowedFd` or `OwnedFd` instead.
|
//! using to `BorrowedFd` or `OwnedFd` instead.
|
||||||
//!
|
//!
|
||||||
@ -54,6 +55,8 @@
|
|||||||
//! Like boxes, `OwnedFd` values conceptually own the resource they point to,
|
//! Like boxes, `OwnedFd` values conceptually own the resource they point to,
|
||||||
//! and free (close) it when they are dropped.
|
//! and free (close) it when they are dropped.
|
||||||
//!
|
//!
|
||||||
|
//! See the [`io` module docs][io-safety] for a general explanation of I/O safety.
|
||||||
|
//!
|
||||||
//! ## `/proc/self/mem` and similar OS features
|
//! ## `/proc/self/mem` and similar OS features
|
||||||
//!
|
//!
|
||||||
//! Some platforms have special files, such as `/proc/self/mem`, which
|
//! Some platforms have special files, such as `/proc/self/mem`, which
|
||||||
@ -74,7 +77,7 @@
|
|||||||
//! necessary to use *sandboxing*, which is outside the scope of `std`.
|
//! necessary to use *sandboxing*, which is outside the scope of `std`.
|
||||||
//!
|
//!
|
||||||
//! [`BorrowedFd<'a>`]: crate::os::unix::io::BorrowedFd
|
//! [`BorrowedFd<'a>`]: crate::os::unix::io::BorrowedFd
|
||||||
//! [I/O safety]: crate::io#io-safety
|
//! [io-safety]: crate::io#io-safety
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
|
@ -6,7 +6,8 @@
|
|||||||
//!
|
//!
|
||||||
//! This module provides three types for representing raw handles and sockets
|
//! This module provides three types for representing raw handles and sockets
|
||||||
//! with different ownership properties: raw, borrowed, and owned, which are
|
//! with different ownership properties: raw, borrowed, and owned, which are
|
||||||
//! analogous to types used for representing pointers. These types reflect the Windows version of [I/O safety].
|
//! analogous to types used for representing pointers. These types reflect concepts of [I/O
|
||||||
|
//! safety][io-safety] on Windows.
|
||||||
//!
|
//!
|
||||||
//! | Type | Analogous to |
|
//! | Type | Analogous to |
|
||||||
//! | ---------------------- | ------------ |
|
//! | ---------------------- | ------------ |
|
||||||
@ -23,8 +24,8 @@
|
|||||||
//! And in new code, they should be considered unsafe to do I/O on (analogous
|
//! And in new code, they should be considered unsafe to do I/O on (analogous
|
||||||
//! to dereferencing them). Rust did not always provide this guidance, so
|
//! to dereferencing them). Rust did not always provide this guidance, so
|
||||||
//! existing code in the Rust ecosystem often doesn't mark `RawHandle` and
|
//! existing code in the Rust ecosystem often doesn't mark `RawHandle` and
|
||||||
//! `RawSocket` usage as unsafe. Once the `io_safety` feature is stable,
|
//! `RawSocket` usage as unsafe.
|
||||||
//! libraries will be encouraged to migrate, either by adding `unsafe` to APIs
|
//! Libraries are encouraged to migrate, either by adding `unsafe` to APIs
|
||||||
//! that dereference `RawHandle` and `RawSocket` values, or by using to
|
//! that dereference `RawHandle` and `RawSocket` values, or by using to
|
||||||
//! `BorrowedHandle`, `BorrowedSocket`, `OwnedHandle`, or `OwnedSocket`.
|
//! `BorrowedHandle`, `BorrowedSocket`, `OwnedHandle`, or `OwnedSocket`.
|
||||||
//!
|
//!
|
||||||
@ -45,9 +46,11 @@
|
|||||||
//! Like boxes, `OwnedHandle` and `OwnedSocket` values conceptually own the
|
//! Like boxes, `OwnedHandle` and `OwnedSocket` values conceptually own the
|
||||||
//! resource they point to, and free (close) it when they are dropped.
|
//! resource they point to, and free (close) it when they are dropped.
|
||||||
//!
|
//!
|
||||||
|
//! See the [`io` module docs][io-safety] for a general explanation of I/O safety.
|
||||||
|
//!
|
||||||
//! [`BorrowedHandle<'a>`]: crate::os::windows::io::BorrowedHandle
|
//! [`BorrowedHandle<'a>`]: crate::os::windows::io::BorrowedHandle
|
||||||
//! [`BorrowedSocket<'a>`]: crate::os::windows::io::BorrowedSocket
|
//! [`BorrowedSocket<'a>`]: crate::os::windows::io::BorrowedSocket
|
||||||
//! [I/O safety]: crate::io#io-safety
|
//! [io-safety]: crate::io#io-safety
|
||||||
|
|
||||||
#![stable(feature = "rust1", since = "1.0.0")]
|
#![stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user