Uh oh!
There was an error while loading. Please reload this page.
Add documentation to point to File::open or OpenOptions::open instead of is_file to check read/write possibility - #73243
Conversation
rust-highfive
commented
Jun 11, 2020
r? @cramertj (rust_highfive has picked a reviewer for you, use r? to override) |
poliorcetics
commented
Jun 11, 2020
@rustbot modify labels: T-doc, T-libs, C-enhancement |
Dylan-DPC-zz
commented
Jun 23, 2020
r? @Amanieu |
steveklabnik
left a comment
There was a problem hiding this comment.
The formatting, grammar, etc, of this all look good to me. I'll let libs decide if they want to add this or not.
Amanieu
commented
Jun 27, 2020
You are forgetting about unix sockets which are another type of file that you can't just read/write bytes to. The proper way of checking whether you can read/write bytes to a file is to try opening it. This will fail for directories, symlinks (if open is called with |
poliorcetics
commented
Jun 27, 2020
@Amanieu good catch ! I changed the text to point to |
!is_dir instead of is_file forFile::open or OpenOptions::open instead of is_file to check read/write possibilityUh oh!
There was an error while loading. Please reload this page.
Amanieu
commented
Jun 27, 2020
@bors r+ rollup |
bors
commented
Jun 27, 2020
📌 Commit 8e8c54a has been approved by |
…Amanieu Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility Fixesrust-lang#64170. This adds documentation to point user towards `!is_dir` instead of `is_file` when all they want to is read from a source. I ran `rg "fn is_file\("` to find all `is_file` methods, I hope I did not miss one.
…Amanieu Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility Fixesrust-lang#64170. This adds documentation to point user towards `!is_dir` instead of `is_file` when all they want to is read from a source. I ran `rg "fn is_file\("` to find all `is_file` methods, I hope I did not miss one.
…Amanieu Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility Fixesrust-lang#64170. This adds documentation to point user towards `!is_dir` instead of `is_file` when all they want to is read from a source. I ran `rg "fn is_file\("` to find all `is_file` methods, I hope I did not miss one.
…arth Rollup of 10 pull requests Successful merges: - rust-lang#72796 (MIR sanity check: validate types on assignment) - rust-lang#73243 (Add documentation to point to `File::open` or `OpenOptions::open` instead of `is_file` to check read/write possibility) - rust-lang#73525 (Prepare for LLVM 11) - rust-lang#73672 (Adds a clearer message for when the async keyword is missing from a f…) - rust-lang#73708 (Explain move errors that occur due to method calls involving `self` (take two)) - rust-lang#73758 (improper_ctypes: fix remaining `Reveal:All`) - rust-lang#73763 (errors: use `-Z terminal-width` in JSON emitter) - rust-lang#73796 (replace more `DefId`s with `LocalDefId`) - rust-lang#73797 (fix typo in self-profile.md) - rust-lang#73809 (Add links to fs::DirEntry::metadata) Failed merges: r? @ghost
Fixes#64170.
This adds documentation to point user towards
!is_dirinstead ofis_filewhen all they want to is read from a source.I ran
rg "fn is_file\("to find allis_filemethods, I hope I did not miss one.