• M
    Stabilize `Path::try_exists()` and improve doc · 56087074
    Martin Habovstiak 提交于
    This stabilizes the `Path::try_exists()` method which returns
    `Result<bool, io::Error>` instead of `bool` allowing handling of errors
    unrelated to the file not existing. (e.g permission errors)
    
    Along with the stabilization it also:
    
    * Warns that the `exists()` method is error-prone and suggests to use
      the newly stabilized one.
    * Suggests it instead of `metadata()` to handle errors.
    * Mentions TOCTOU bugs to avoid false assumption that `try_exists()` is
      completely safe fixed version of `exists()`.
    * Renames the feature of still-unstable `std::fs::try_exists()` to
      `fs_try_exists` to avoid name conflict.
    
    The tracking issue #83186 remains open to track `fs_try_exists`.
    56087074
lib.rs 17.6 KB