]> git.lizzy.rs Git - rust.git/commitdiff
Add precision for create_dir function
authorGuillaume Gomez <guillaume1.gomez@gmail.com>
Fri, 2 Nov 2018 17:23:51 +0000 (18:23 +0100)
committerGuillaume Gomez <guillaume1.gomez@gmail.com>
Sun, 4 Nov 2018 11:37:43 +0000 (12:37 +0100)
src/libstd/fs.rs

index 017949291bcf16e37f200141b9254d9fdbaad544..49012a7d3419604d8ec943ae409619b2aded356a 100644 (file)
@@ -1755,12 +1755,19 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
 ///
 /// [changes]: ../io/index.html#platform-specific-behavior
 ///
+/// **NOTE**: If a parent of the given path doesn't exist, this function will
+/// return an error. To create a directory and all its missing parents at the
+/// same time, use the [`create_dir_all`] function.
+///
 /// # Errors
 ///
 /// This function will return an error in the following situations, but is not
 /// limited to just these cases:
 ///
 /// * User lacks permissions to create directory at `path`.
+/// * A parent of the given path doesn't exist. (To create a directory and all
+///   its missing parents at the same time, use the [`create_dir_all`]
+///   function.)
 /// * `path` already exists.
 ///
 /// # Examples