Skip to content

Commit 337fad4

Browse files
authored
Rollup merge of rust-lang#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.
2 parents 1ac413d + 15f4171 commit 337fad4

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

std/src/path.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,6 +3037,14 @@ impl Path {
30373037
///
30383038
/// This is an alias to [`fs::canonicalize`].
30393039
///
3040+
/// # Errors
3041+
///
3042+
/// This method will return an error in the following situations, but is not
3043+
/// limited to just these cases:
3044+
///
3045+
/// * `path` does not exist.
3046+
/// * A non-final component in path is not a directory.
3047+
///
30403048
/// # Examples
30413049
///
30423050
/// ```no_run

0 commit comments

Comments
 (0)