1
Fork 0

Rollup merge of #126140 - eduardosm:stabilize-fs_try_exists, r=Amanieu

Rename `std::fs::try_exists` to  `std::fs::exists` and stabilize fs_try_exists

FCP completed in tracking issue.

Tracking issue: https://github.com/rust-lang/rust/issues/83186

Closes https://github.com/rust-lang/rust/issues/83186

Stabilized API:

```rust
mod fs {
    pub fn exists<P: AsRef<Path>>(path: P) -> io::Result<bool>;
}
```
This commit is contained in:
Matthias Krüger 2024-06-22 19:33:55 +02:00 committed by GitHub
commit f3ced9d540
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 18 additions and 19 deletions

View file

@ -2907,6 +2907,8 @@ impl Path {
/// prevent time-of-check to time-of-use (TOCTOU) bugs. You should only use it in scenarios
/// where those bugs are not an issue.
///
/// This is an alias for [`std::fs::exists`](crate::fs::exists).
///
/// # Examples
///
/// ```no_run
@ -2919,7 +2921,7 @@ impl Path {
#[stable(feature = "path_try_exists", since = "1.63.0")]
#[inline]
pub fn try_exists(&self) -> io::Result<bool> {
fs::try_exists(self)
fs::exists(self)
}
/// Returns `true` if the path exists on disk and is pointing at a regular file.