clarify what you cannot do

This commit is contained in:
Ralf Jung 2023-08-22 09:00:07 +02:00
parent 2cb9d3def2
commit 6d65379e7a

View File

@ -255,9 +255,9 @@
//! The platform-specific parts of the Rust standard library expose types that reflect these //! The platform-specific parts of the Rust standard library expose types that reflect these
//! concepts, see [`os::unix`] and [`os::windows`]. //! concepts, see [`os::unix`] and [`os::windows`].
//! //!
//! To uphold I/O safety, it is crucial that no code acts on file descriptors it does not own. In //! To uphold I/O safety, it is crucial that no code acts on file descriptors it does not own or
//! other words, a safe function that takes a regular integer, treats it as a file descriptor, and //! borrow, and no code closes file descriptors it does not own. In other words, a safe function
//! acts on it, is *unsound*. //! that takes a regular integer, treats it as a file descriptor, and acts on it, is *unsound*.
//! //!
//! Not upholding I/O safety and acting on a file descriptor without proof of ownership can lead to //! Not upholding I/O safety and acting on a file descriptor without proof of ownership can lead to
//! misbehavior and even Undefined Behavior in code that relies on ownership of its file //! misbehavior and even Undefined Behavior in code that relies on ownership of its file