about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-02 19:01:01 +0000
committerbors <bors@rust-lang.org>2017-08-02 19:01:01 +0000
commitb75d1f0ce252f4b53f8a97aee0fcf4a785186fef (patch)
treec039a5164f64464a0669e93d78a9e1e747d7c1f6 /src/libstd
parent4596c71fc5556966a86a226f55f0d0deb9493e60 (diff)
parent4792d28ef1ce958698d20d7c20baa78c83c3140e (diff)
downloadrust-b75d1f0ce252f4b53f8a97aee0fcf4a785186fef.tar.gz
rust-b75d1f0ce252f4b53f8a97aee0fcf4a785186fef.zip
Auto merge of #43614 - pornel:is_gotcha, r=BurntSushi
Emphasise that these functions look at the disk, not just the path

I thought that `PathBuf::new("foo/bar/").is_dir()` is always true, because the path ends in `/`. However, this is not what `is_dir()` function does. So I've updated the docs to make it clear.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/path.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index e083ab0ef97..c90a0c78527 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -2237,7 +2237,7 @@ impl Path {
         fs::metadata(self).is_ok()
     }
 
-    /// Returns whether the path is pointing at a regular file.
+    /// Returns whether the path exists on disk and is pointing at a regular file.
     ///
     /// This function will traverse symbolic links to query information about the
     /// destination file. In case of broken symbolic links this will return `false`.
@@ -2266,7 +2266,7 @@ impl Path {
         fs::metadata(self).map(|m| m.is_file()).unwrap_or(false)
     }
 
-    /// Returns whether the path is pointing at a directory.
+    /// Returns whether the path exists on disk and is pointing at a directory.
     ///
     /// This function will traverse symbolic links to query information about the
     /// destination file. In case of broken symbolic links this will return `false`.