-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: improve std::fs::read doc #114448
docs: improve std::fs::read doc #114448
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (or someone else) soon. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Perhaps we should do more here and also explain what is so special about As a reader the intent of this whole sentence is not clear to me. |
Agree, IMO, any error that could be constructed from |
I see. If that is the case, why do we say it can throw errors other than |
library/std/src/fs.rs
Outdated
/// Also, while reading, an error of a kind other than [`io::ErrorKind::Interrupted`] | ||
/// can be returned if it is encountered. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Also, while reading, an error of a kind other than [`io::ErrorKind::Interrupted`] | |
/// can be returned if it is encountered. | |
/// Reading from the file handles [`io::ErrorKind::Interrupted`] with automatic retries. See [`io::Read`] documentation for details. |
https://doc.rust-lang.org/nightly/std/io/trait.Read.html#errors-1 has some further discussion of this -- just a suggestion on possible text here, I think this reads better than both master and the PR proposal. But happy to merge some other form.
Let's also update the similar text on line ~274.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done:)
library/std/src/fs.rs
Outdated
@@ -233,8 +233,8 @@ pub struct DirBuilder { | |||
/// This function will return an error if `path` does not already exist. | |||
/// Other errors may also be returned according to [`OpenOptions::open`]. | |||
/// | |||
/// It will also return an error if it encounters while reading an error | |||
/// of a kind other than [`io::ErrorKind::Interrupted`]. | |||
/// Reading from the file handles [`io::ErrorKind::Interrupted`] with automatic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Reading from the file handles [`io::ErrorKind::Interrupted`] with automatic | |
/// While reading from the file, handles [`io::ErrorKind::Interrupted`] with automatic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes more sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My suggestion seems a wee bit confusing without the next line for context...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about adding a subject to the sentence:
While reading from the file, this function handles [io::ErrorKind::Interrupted
] with automatic retries. See [io::Read
] documentation for details.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me.
I just pushed the new code comment, ping me if you need me to squash the commits |
r=me with commits squashed |
|
Does this instruction mean that I need to squash my commits? I thought it can be done automatically |
You need to squash your commits. GitHub can do it automatically if you merge via GitHub but the Rust organization does not use GitHub to merge commits. Rust uses an implementation of the same concept behind GitHub merge queues- you only merge if the merged state would pass the tests. Which means you must test merges one-at-a-time. Here's the queue for this repo: https://bors.rust-lang.org/queue/rust People say "r=me with..." to indicate that anyone else with review permissions can send this off to the merge queue when the thing is done. |
ddfa40e
to
0e270b1
Compare
Commits squashed, thanks for you detaild explanation:) |
@bors r=Mark-Simulacrum rollup=always |
☀️ Test successful - checks-actions |
Finished benchmarking commit (dc348db): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)ResultsThis is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
CyclesThis benchmark run did not return any relevant results for this metric. Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 631.304s -> 632.086s (0.12%) |
What does this PR do
std::fs::read()
Closes #114432
cc @Dexus0 @saethlin