mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Rollup merge of #110266 - tgross35:try-exists-wording, r=jyn514
Update documentation wording on path 'try_exists' functions Just eliminate the quadruple negation in `doesn't silently ignore errors unrelated to ... not existing.`
This commit is contained in:
commit
ce30232f16
@ -2515,9 +2515,10 @@ 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 [`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.)
|
||||
/// As opposed to the [`Path::exists`] method, this will only return `Ok(true)` or `Ok(false)`
|
||||
/// if the path was _verified_ to exist or not exist. If its existence can neither be confirmed
|
||||
/// nor denied, an `Err(_)` will be propagated instead. This can be the case if e.g. listing
|
||||
/// permission is denied on one of the parent directories.
|
||||
///
|
||||
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
|
||||
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
|
||||
|
@ -2844,9 +2844,11 @@ 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
|
||||
/// unrelated to the path not existing. (E.g. it will return `Err(_)` in case of permission
|
||||
/// denied on some of the parent directories.)
|
||||
/// [`Path::exists()`] only checks whether or not a path was both found and readable. By
|
||||
/// contrast, `try_exists` will return `Ok(true)` or `Ok(false)`, respectively, if the path
|
||||
/// was _verified_ to exist or not exist. If its existence can neither be confirmed nor
|
||||
/// denied, it will propagate an `Err(_)` instead. This can be the case if e.g. listing
|
||||
/// permission is denied on one of the parent directories.
|
||||
///
|
||||
/// Note that while this avoids some pitfalls of the `exists()` method, it still can not
|
||||
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
|
||||
|
Loading…
Reference in New Issue
Block a user