Skip to content

Commit 4366059

Browse files
authored
Rollup merge of #89051 - schctl:master, r=jyn514
Add intra-doc links and small changes to `std::os` to be more consistent I believe that a few items in `std::os` should be linked. I've also added a basic example in `std::os::windows`.
2 parents 61bfe36 + ec34aa6 commit 4366059

File tree

16 files changed

+60
-15
lines changed

16 files changed

+60
-15
lines changed

library/std/src/os/linux/fs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Linux-specific extensions to primitives in the `std::fs` module.
1+
//! Linux-specific extensions to primitives in the [`std::fs`] module.
2+
//!
3+
//! [`std::fs`]: crate::fs
24
35
#![stable(feature = "metadata_ext", since = "1.1.0")]
46

library/std/src/os/linux/process.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Linux-specific extensions to primitives in the `std::process` module.
1+
//! Linux-specific extensions to primitives in the [`std::process`] module.
2+
//!
3+
//! [`std::process`]: crate::process
24
35
#![unstable(feature = "linux_pidfd", issue = "82971")]
46

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

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Unix-specific extension to the primitives in the `std::ffi` module.
1+
//! Unix-specific extensions to primitives in the [`std::ffi`] module.
22
//!
33
//! # Examples
44
//!
@@ -31,6 +31,8 @@
3131
//! let bytes = os_str.as_bytes();
3232
//! assert_eq!(bytes, b"foo");
3333
//! ```
34+
//!
35+
//! [`std::ffi`]: crate::ffi
3436
3537
#![stable(feature = "rust1", since = "1.0.0")]
3638

library/std/src/os/unix/fs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Unix-specific extensions to primitives in the `std::fs` module.
1+
//! Unix-specific extensions to primitives in the [`std::fs`] module.
2+
//!
3+
//! [`std::fs`]: crate::fs
24
35
#![stable(feature = "rust1", since = "1.0.0")]
46

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

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
//! exposes Unix-specific functions that would otherwise be inappropriate as
55
//! part of the core `std` library.
66
//!
7-
//! It exposes more ways to deal with platform-specific strings (`OsStr`,
8-
//! `OsString`), allows to set permissions more granularly, extract low-level
7+
//! It exposes more ways to deal with platform-specific strings ([`OsStr`],
8+
//! [`OsString`]), allows to set permissions more granularly, extract low-level
99
//! file descriptors from files and sockets, and has platform-specific helpers
1010
//! for spawning processes.
1111
//!
@@ -24,6 +24,9 @@
2424
//! Ok(())
2525
//! }
2626
//! ```
27+
//!
28+
//! [`OsStr`]: crate::ffi::OsStr
29+
//! [`OsString`]: crate::ffi::OsString
2730
2831
#![stable(feature = "rust1", since = "1.0.0")]
2932
#![doc(cfg(unix))]

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Unix-specific networking functionality
1+
//! Unix-specific networking functionality.
22
33
#![stable(feature = "unix_socket", since = "1.10.0")]
44

library/std/src/os/unix/process.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Unix-specific extensions to primitives in the `std::process` module.
1+
//! Unix-specific extensions to primitives in the [`std::process`] module.
2+
//!
3+
//! [`std::process`]: crate::process
24
35
#![stable(feature = "rust1", since = "1.0.0")]
46

library/std/src/os/unix/thread.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Unix-specific extensions to primitives in the `std::thread` module.
1+
//! Unix-specific extensions to primitives in the [`std::thread`] module.
2+
//!
3+
//! [`std::thread`]: crate::thread
24
35
#![stable(feature = "thread_extensions", since = "1.9.0")]
46

library/std/src/os/wasi/ffi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! WASI-specific extension to the primitives in the `std::ffi` module
1+
//! WASI-specific extensions to primitives in the [`std::ffi`] module
2+
//!
3+
//! [`std::ffi`]: crate::ffi
24
35
#![stable(feature = "rust1", since = "1.0.0")]
46

library/std/src/os/wasi/fs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! WASI-specific extensions to primitives in the `std::fs` module.
1+
//! WASI-specific extensions to primitives in the [`std::fs`] module.
2+
//!
3+
//! [`std::fs`]: crate::fs
24
35
#![deny(unsafe_op_in_unsafe_fn)]
46
#![unstable(feature = "wasi_ext", issue = "71213")]

library/std/src/os/wasi/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
//! Ok(())
2525
//! }
2626
//! ```
27+
//!
28+
//! [`OsStr`]: crate::ffi::OsStr
29+
//! [`OsString`]: crate::ffi::OsString
2730
2831
#![stable(feature = "rust1", since = "1.0.0")]
2932
#![deny(unsafe_op_in_unsafe_fn)]

library/std/src/os/windows/ffi.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Windows-specific extensions to the primitives in the `std::ffi` module.
1+
//! Windows-specific extensions to primitives in the [`std::ffi`] module.
22
//!
33
//! # Overview
44
//!
@@ -49,6 +49,7 @@
4949
//! [ill-formed-utf-16]: https://simonsapin.github.io/wtf-8/#ill-formed-utf-16
5050
//! [`collect`]: crate::iter::Iterator::collect
5151
//! [U+FFFD]: crate::char::REPLACEMENT_CHARACTER
52+
//! [`std::ffi`]: crate::ffi
5253
5354
#![stable(feature = "rust1", since = "1.0.0")]
5455

library/std/src/os/windows/fs.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Windows-specific extensions for the primitives in the `std::fs` module.
1+
//! Windows-specific extensions to primitives in the [`std::fs`] module.
2+
//!
3+
//! [`std::fs`]: crate::fs
24
35
#![stable(feature = "rust1", since = "1.0.0")]
46

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

+16
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
//! the core `std` library. These extensions allow developers to use
66
//! `std` types and idioms with Windows in a way that the normal
77
//! platform-agnostic idioms would not normally support.
8+
//!
9+
//! # Examples
10+
//!
11+
//! ```no_run
12+
//! use std::fs::File;
13+
//! use std::os::windows::prelude::*;
14+
//!
15+
//! fn main() -> std::io::Result<()> {
16+
//! let f = File::create("foo.txt")?;
17+
//! let handle = f.as_raw_handle();
18+
//!
19+
//! // use handle with native windows bindings
20+
//!
21+
//! Ok(())
22+
//! }
23+
//! ```
824
925
#![stable(feature = "rust1", since = "1.0.0")]
1026
#![doc(cfg(windows))]

library/std/src/os/windows/process.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Extensions to `std::process` for Windows.
1+
//! Windows-specific extensions to primitives in the [`std::process`] module.
2+
//!
3+
//! [`std::process`]: crate::process
24
35
#![stable(feature = "process_extensions", since = "1.2.0")]
46

library/std/src/os/windows/thread.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
//! Extensions to `std::thread` for Windows.
1+
//! Windows-specific extensions to primitives in the [`std::thread`] module.
2+
//!
3+
//! [`std::thread`]: crate::thread
24
35
#![stable(feature = "thread_extensions", since = "1.9.0")]
46

0 commit comments

Comments
 (0)