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 @@ -2515,9 +2515,10 @@ impl AsInnerMut<fs_imp::DirBuilder> for DirBuilder {
2515
2515
/// This function will traverse symbolic links to query information about the
2516
2516
/// destination file. In case of broken symbolic links this will return `Ok(false)`.
2517
2517
///
2518
- /// As opposed to the [`Path::exists`] method, this one doesn't silently ignore errors
2519
- /// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
2520
- /// denied on some of the parent directories.)
2518
+ /// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
2519
+ /// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
2520
+ /// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
2521
+ /// permission is denied on one of the parent directories.
2521
2522
///
2522
2523
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
2523
2524
/// 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