File tree 2 files changed +9
-6
lines changed
2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -2511,9 +2511,10 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
2511
2511
/// This function will traverse symbolic links to query information about the
2512
2512
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
2513
2513
///
2514
- /// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
2515
- /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2516
- /// denied on some of the parent directories.)
2514
+ /// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
2515
+ /// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
2516
+ /// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
2517
+ /// permission is denied on one of the parent directories.
2517
2518
///
2518
2519
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
2519
2520
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
Original file line number Diff line number Diff line change @@ -2844,9 +2844,11 @@ impl Path {
2844
2844
/// This function will traverse symbolic links to query information about the
2845
2845
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
2846
2846
///
2847
- /// As opposed to the [`exists()`] method, this one doesn't silently ignore errors
2848
- /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2849
- /// denied on some of the parent directories.)
2847
+ /// [`Path::exists()`] only checks whether or not a path was both found and readable. By
2848
+ /// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path
2849
+ /// was _verified_ to exist or not exist. If its existence can neither be confirmed nor
2850
+ /// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing
2851
+ /// permission is denied on one of the parent directories.
2850
2852
///
2851
2853
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
2852
2854
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
You can’t perform that action at this time.
0 commit comments