diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-09-08 16:34:57 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-08 16:34:57 +0200 |
| commit | d1ab870a07214a91a223fa60d7080064d13259fc (patch) | |
| tree | 408f006c34c9330ca53bb6f41e2f5e70e229268f /library/std/src | |
| parent | 9a1feef5d8305b78a2b4955e322c2aaf628bd02b (diff) | |
| parent | 4b5d0e02ca2647bf1efb2ecd3303c21ead64d2ea (diff) | |
| download | rust-d1ab870a07214a91a223fa60d7080064d13259fc.tar.gz rust-d1ab870a07214a91a223fa60d7080064d13259fc.zip | |
Rollup merge of #146299 - smirzaei:doc/improve-path-canonicalize-docs, r=jhpratt
docs(std): add error docs for path canonicalize This PR adds the missing error documentation for both [Path.canonicalize](https://doc.rust-lang.org/std/path/struct.Path.html#method.canonicalize) and [PathBuf.canonicalize](https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.canonicalize) methods. Since both methods are wappers around [fs::canonicalize](https://doc.rust-lang.org/std/fs/fn.canonicalize.html), the error doc is copied directly from that function. This makes it faster to find what errors might arise when calling `path.canonicalize` or `path_buf.canonicalize` in the editor itself without needing to drill down to the `fs::canonicalzie` docs.
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/path.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/library/std/src/path.rs b/library/std/src/path.rs index 19663e4a9df..70ba502d684 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -3037,6 +3037,14 @@ impl Path { /// /// This is an alias to [`fs::canonicalize`]. /// + /// # Errors + /// + /// This method will return an error in the following situations, but is not + /// limited to just these cases: + /// + /// * `path` does not exist. + /// * A non-final component in path is not a directory. + /// /// # Examples /// /// ```no_run |
