Skip to content

Commit f586047

Browse files
Rollup merge of rust-lang#155652 - ChrisDenton:empty-docs, r=jhpratt
Expand `Path::is_empty` docs Give some reasons why you might want to check if a path is empty. The `Path::join` behaviour can be surprising if you're not aware it might happen.
2 parents 333f033 + 110e67c commit f586047

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

library/std/src/path.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2828,6 +2828,10 @@ impl Path {
28282828

28292829
/// Checks whether the `Path` is empty.
28302830
///
2831+
/// Passing an empty path to most OS filesystem APIs will always result in an error.
2832+
///
2833+
/// [Pushing][PathBuf::push] an empty path to an existing path will append a directory separator unless it already ends with a separator or the existing path is itself empty.
2834+
///
28312835
/// # Examples
28322836
///
28332837
/// ```

0 commit comments

Comments
 (0)