diff options
| author | Nathan Collins <nathan.collins@gmail.com> | 2025-08-12 14:37:15 +0800 |
|---|---|---|
| committer | Trevor Gross <tmgross@umich.edu> | 2025-08-27 04:58:02 +0000 |
| commit | 0b4f9783f0e11df0a3bed7fdea0628ee4b31a6f3 (patch) | |
| tree | 5376f101cf9f9c0fa0b569a9f734273c49e67446 | |
| parent | a1531335fe2807715fff569904d99602022643a7 (diff) | |
| download | rust-0b4f9783f0e11df0a3bed7fdea0628ee4b31a6f3.tar.gz rust-0b4f9783f0e11df0a3bed7fdea0628ee4b31a6f3.zip | |
Improve std::fs::read_dir docs
Call out early that the results returned can differ across calls / aren't deterministic. This was already mentioned at the bottom of examples, but I think it's worth calling out early, since this caused at least one person (me!) great confusion. [ Added a comma to the docs, reflowed commit message - Trevor ]
| -rw-r--r-- | library/std/src/fs.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index a220a3f56e9..6001b04d88e 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -3036,6 +3036,9 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> { /// Entries for the current and parent directories (typically `.` and `..`) are /// skipped. /// +/// The order in which `read_dir` returns entries can change between calls. If reproducible +/// ordering is required, the entries should be explicitly sorted. +/// /// # Platform-specific behavior /// /// This function currently corresponds to the `opendir` function on Unix |
