Skip to content
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

Enhance the documentation of BufReader for potential data loss #65554

Merged
merged 2 commits into from
Nov 8, 2019

Conversation

gliderkite
Copy link

This is (IMO) and enhancement of the std::io::BufReader documentation, that aims to highlight how relatively easy is to end up with data loss when improperly using an instance of this class.

This is following the issue I had figuring out why my application was loosing data, because I focused my attention on the word multiple instances of BufReader in its struct documentation, even if I ever only had one instance.

Link to the issue: tokio-rs/tokio#1662

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @KodrAus (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 18, 2019
@@ -24,7 +24,8 @@ use crate::memchr;
///
/// When the `BufReader<R>` is dropped, the contents of its buffer will be
/// discarded. Creating multiple instances of a `BufReader<R>` on the same
/// stream can cause data loss.
/// stream can cause data loss, as well as reading from the underlying reader
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about:

Reading from the underlying reader after unwrapping the BufReader<R> with BufReader::into_inner can also cause data loss.

@KodrAus
Copy link
Contributor

KodrAus commented Oct 24, 2019

@gliderkite Ah, would you be able to rebase your PR on top of rust-lang master rather than merging? It looks like our history’s gotten a bit tangled here.

@hdhoang hdhoang added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 31, 2019
@hdhoang
Copy link
Contributor

hdhoang commented Oct 31, 2019

ping from triage @gliderkite, could you rebase as suggested above? It would really help with reviewing. Thanks!

@gliderkite gliderkite force-pushed the bufreader-doc-enhance branch from 6578cfa to 5b5196a Compare October 31, 2019 10:52
@gliderkite
Copy link
Author

ping from triage @gliderkite, could you rebase as suggested above? It would really help with reviewing. Thanks!

Rebased, sorry about the confusion.

Copy link
Contributor

@KodrAus KodrAus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @gliderkite!

This looks good to me.

@KodrAus
Copy link
Contributor

KodrAus commented Nov 7, 2019

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Nov 7, 2019

📌 Commit 5b5196a has been approved by KodrAus

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 7, 2019
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Nov 8, 2019
…=KodrAus

Enhance the documentation of BufReader for potential data loss

This is (IMO) and enhancement of the `std::io::BufReader` documentation, that aims to highlight how relatively easy is to end up with data loss when improperly using an instance of this class.

This is following the issue I had figuring out why my application was loosing data, because I focused my attention on the word *multiple instances* of `BufReader` in its `struct` documentation, even if I ever only had one instance.

Link to the issue: tokio-rs/tokio#1662
bors added a commit that referenced this pull request Nov 8, 2019
Rollup of 8 pull requests

Successful merges:

 - #65554 (Enhance the documentation of BufReader for potential data loss)
 - #65580 (Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut`)
 - #66049 (consistent handling of missing sysroot spans)
 - #66056 (rustc_metadata: Some reorganization of the module structure)
 - #66123 (No more hidden elements)
 - #66157 (Improve math log documentation examples)
 - #66165 (Ignore these tests ,since the called commands doesn't exist in VxWorks)
 - #66190 (rustc_target: inline abi::FloatTy into abi::Primitive.)

Failed merges:

 - #66188 (`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn`)

r? @ghost
@bors bors merged commit 5b5196a into rust-lang:master Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants