Skip to content

Commit bc9655a

Browse files
authored
Rollup merge of #145290 - ntc2:patch-1, r=joshtriplett,tgross35
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.
2 parents 7879cbb + 0b4f978 commit bc9655a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

library/std/src/fs.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3036,6 +3036,9 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
30363036
/// Entries for the current and parent directories (typically `.` and `..`) are
30373037
/// skipped.
30383038
///
3039+
/// The order in which `read_dir` returns entries can change between calls. If reproducible
3040+
/// ordering is required, the entries should be explicitly sorted.
3041+
///
30393042
/// # Platform-specific behavior
30403043
///
30413044
/// This function currently corresponds to the `opendir` function on Unix

0 commit comments

Comments
 (0)