Skip to content

Commit 424fecd

Browse files
Add precision for create_dir function
1 parent 5ea8eb5 commit 424fecd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libstd/fs.rs

+7
Original file line numberDiff line numberDiff line change
@@ -1755,12 +1755,19 @@ pub fn canonicalize<P: AsRef<Path>>(path: P) -> io::Result<PathBuf> {
17551755
///
17561756
/// [changes]: ../io/index.html#platform-specific-behavior
17571757
///
1758+
/// **NOTE**: If a parent of the given path doesn't exist, this function will
1759+
/// return an error. To create a directory and all its missing parents at the
1760+
/// same time, use the [`create_dir_all`] function.
1761+
///
17581762
/// # Errors
17591763
///
17601764
/// This function will return an error in the following situations, but is not
17611765
/// limited to just these cases:
17621766
///
17631767
/// * User lacks permissions to create directory at `path`.
1768+
/// * A parent of the given path doesn't exist. (To create a directory and all
1769+
/// its missing parents at the same time, use the [`create_dir_all`]
1770+
/// function.)
17641771
/// * `path` already exists.
17651772
///
17661773
/// # Examples

0 commit comments

Comments
 (0)