diff options
| author | kennytm <kennytm@gmail.com> | 2018-11-06 15:21:02 +0800 |
|---|---|---|
| committer | kennytm <kennytm@gmail.com> | 2018-11-06 17:08:10 +0800 |
| commit | 082156b2ac419dcb9e07c6a0ccb86830f2d147f7 (patch) | |
| tree | a6ff9525a6d2f7c64536771e4d78c41da4bb3120 /src/libstd | |
| parent | 6091696cfd7d4661b8e9352eeb1e87eff29f15fa (diff) | |
| parent | 424fecdfb612f82527d8b74be3510b2171d0f5b3 (diff) | |
| download | rust-082156b2ac419dcb9e07c6a0ccb86830f2d147f7.tar.gz rust-082156b2ac419dcb9e07c6a0ccb86830f2d147f7.zip | |
Rollup merge of #55621 - GuillaumeGomez:create-dir, r=QuietMisdreavus
Add precision for create_dir function Took me a while to find the other equivalent so it seems to be necessary. r? @QuietMisdreavus
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/fs.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs index 017949291bc..49012a7d341 100644 --- a/src/libstd/fs.rs +++ b/src/libstd/fs.rs @@ -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 |
