Skip to content

Commit 4c8bc04

Browse files
authored
Rollup merge of #95397 - dtolnay:disclaimer, r=m-ou-se
Link to std::io's platform-specific behavior disclaimer This PR adds some links in standard library documentation to point to https://doc.rust-lang.org/std/io/index.html#platform-specific-behavior. > ### Platform-specific behavior > > Many I/O functions throughout the standard library are documented to indicate what various library or syscalls they are delegated to. This is done to help applications both understand what’s happening under the hood as well as investigate any possibly unclear semantics. Note, however, that this is informative, not a binding contract. The implementation of many of these functions are subject to change over time and may call fewer or more syscalls/library functions. Many of the `std::fs` APIs already link to this disclaimer when discussing system calls.
2 parents ce319ac + d55854d commit 4c8bc04

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

library/std/src/env.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ use crate::sys::os as os_imp;
2525
///
2626
/// # Platform-specific behavior
2727
///
28-
/// This function currently corresponds to the `getcwd` function on Unix
28+
/// This function [currently] corresponds to the `getcwd` function on Unix
2929
/// and the `GetCurrentDirectoryW` function on Windows.
3030
///
31+
/// [currently]: crate::io#platform-specific-behavior
32+
///
3133
/// # Errors
3234
///
3335
/// Returns an [`Err`] if the current working directory value is invalid.
@@ -56,11 +58,13 @@ pub fn current_dir() -> io::Result<PathBuf> {
5658
///
5759
/// # Platform-specific behavior
5860
///
59-
/// This function currently corresponds to the `chdir` function on Unix
61+
/// This function [currently] corresponds to the `chdir` function on Unix
6062
/// and the `SetCurrentDirectoryW` function on Windows.
6163
///
6264
/// Returns an [`Err`] if the operation fails.
6365
///
66+
/// [currently]: crate::io#platform-specific-behavior
67+
///
6468
/// # Examples
6569
///
6670
/// ```

library/std/src/time.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ pub use core::time::FromFloatSecsError;
101101
/// ```
102102
///
103103
/// # Underlying System calls
104-
/// Currently, the following system calls are being used to get the current time using `now()`:
104+
///
105+
/// The following system calls are [currently] being used by `now()` to find out
106+
/// the current time:
105107
///
106108
/// | Platform | System call |
107109
/// |-----------|----------------------------------------------------------------------|
@@ -113,6 +115,7 @@ pub use core::time::FromFloatSecsError;
113115
/// | WASI | [__wasi_clock_time_get (Monotonic Clock)] |
114116
/// | Windows | [QueryPerformanceCounter] |
115117
///
118+
/// [currently]: crate::io#platform-specific-behavior
116119
/// [QueryPerformanceCounter]: https://docs.microsoft.com/en-us/windows/win32/api/profileapi/nf-profileapi-queryperformancecounter
117120
/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
118121
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
@@ -203,7 +206,8 @@ pub struct Instant(time::Instant);
203206
/// For example, on Windows the time is represented in 100 nanosecond intervals whereas Linux
204207
/// can represent nanosecond intervals.
205208
///
206-
/// Currently, the following system calls are being used to get the current time using `now()`:
209+
/// The following system calls are [currently] being used by `now()` to find out
210+
/// the current time:
207211
///
208212
/// | Platform | System call |
209213
/// |-----------|----------------------------------------------------------------------|
@@ -215,6 +219,7 @@ pub struct Instant(time::Instant);
215219
/// | WASI | [__wasi_clock_time_get (Realtime Clock)] |
216220
/// | Windows | [GetSystemTimePreciseAsFileTime] / [GetSystemTimeAsFileTime] |
217221
///
222+
/// [currently]: crate::io#platform-specific-behavior
218223
/// [`insecure_time` usercall]: https://edp.fortanix.com/docs/api/fortanix_sgx_abi/struct.Usercalls.html#method.insecure_time
219224
/// [timekeeping in SGX]: https://edp.fortanix.com/docs/concepts/rust-std/#codestdtimecode
220225
/// [gettimeofday]: https://man7.org/linux/man-pages/man2/gettimeofday.2.html

0 commit comments

Comments
 (0)