Skip to content

Commit 3492900

Browse files
authored
Rollup merge of rust-lang#87838 - jetomit:add-readdir-note, r=dtolnay
Document that fs::read_dir skips . and .. Hi, I think this is worth noting in the docs since it differs from POSIX `readdir`. I didn’t put it under platform-specific notes because it seems to be consistent across platforms, and changing this behavior in the future could cause pretty nasty bugs. Thanks!
2 parents 08f56b7 + c32e4ba commit 3492900

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/std/src/fs.rs

+2
Original file line numberDiff line numberDiff line change
@@ -2039,6 +2039,8 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
20392039
///
20402040
/// The iterator will yield instances of [`io::Result`]`<`[`DirEntry`]`>`.
20412041
/// New errors may be encountered after an iterator is initially constructed.
2042+
/// Entries for the current and parent directories (typically `.` and `..`) are
2043+
/// skipped.
20422044
///
20432045
/// # Platform-specific behavior
20442046
///

0 commit comments

Comments
 (0)