diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-02-04 14:59:02 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-04 14:59:02 +0100 |
| commit | f070e0b5a654b51d88e3e1bea1bf5f2bb52b38e5 (patch) | |
| tree | bcc1ccd9c5d403b31e2a306e152bf93d835b5ef3 /library/std/src | |
| parent | 3876cb6b8e2d0badb17e534848bd79bd3d0d8ba5 (diff) | |
| parent | 1bc8f0b49f34927c08d1f31d2bb32ab7404ec948 (diff) | |
| download | rust-f070e0b5a654b51d88e3e1bea1bf5f2bb52b38e5.tar.gz rust-f070e0b5a654b51d88e3e1bea1bf5f2bb52b38e5.zip | |
Rollup merge of #93555 - ChrisDenton:fs-try-exists-doc, r=Mark-Simulacrum
Link `try_exists` docs to `Path::exists` Links to the existing `Path::exists` method from both `std::Path::try_exists` and `std::fs:try_exists`. Tracking issue for `path_try_exists`: #83186
Diffstat (limited to 'library/std/src')
| -rw-r--r-- | library/std/src/fs.rs | 4 | ||||
| -rw-r--r-- | library/std/src/path.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 9d6b2fe8c25..7ca64c38e5d 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -2288,7 +2288,7 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder { /// This function will traverse symbolic links to query information about the /// destination file. In case of broken symbolic links this will return `Ok(false)`. /// -/// As opposed to the `exists()` method, this one doesn't silently ignore errors +/// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// denied on some of the parent directories.) /// @@ -2301,6 +2301,8 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder { /// assert!(!fs::try_exists("does_not_exist.txt").expect("Can't check existence of file does_not_exist.txt")); /// assert!(fs::try_exists("/root/secret_file.txt").is_err()); /// ``` +/// +/// [`Path::exists`]: crate::path::Path::exists // FIXME: stabilization should modify documentation of `exists()` to recommend this method // instead. #[unstable(feature = "path_try_exists", issue = "83186")] diff --git a/library/std/src/path.rs b/library/std/src/path.rs index e540f860160..85cad65da6a 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -2730,7 +2730,7 @@ impl Path { /// This function will traverse symbolic links to query information about the /// destination file. In case of broken symbolic links this will return `Ok(false)`. /// - /// As opposed to the `exists()` method, this one doesn't silently ignore errors + /// As opposed to the [`exists()`] method, this one doesn't silently ignore errors /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission /// denied on some of the parent directories.) /// @@ -2743,6 +2743,8 @@ impl Path { /// assert!(!Path::new("does_not_exist.txt").try_exists().expect("Can't check existence of file does_not_exist.txt")); /// assert!(Path::new("/root/secret_file.txt").try_exists().is_err()); /// ``` + /// + /// [`exists()`]: Self::exists // FIXME: stabilization should modify documentation of `exists()` to recommend this method // instead. #[unstable(feature = "path_try_exists", issue = "83186")] |
