-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Add warning to BufWriter documentation #43136
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @BurntSushi (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. |
Adding this warning seems sensible enough to me. I think the only question is whether this now makes the behavior part of the public API, and if so, whether we're comfortable with that or not. I kind of feel like it's already the de facto API, so these docs are just recognizing that. Anyone else from @rust-lang/libs want to weigh in? |
Seems like a fine change to me! |
@bors: r+ rollup thank you! |
📌 Commit c6b280e has been approved by |
…bnik Add warning to BufWriter documentation When using `BufWriter`, it is very easy to unintentionally ignore errors, because errors which occur when flushing buffered data when the `BufWriter` is dropped are ignored. This has been noted in a couple places: rust-lang#32677, rust-lang#37045. There has been some discussion about how to fix this problem in rust-lang#32677, but no solution seems likely to land in the near future. For now, anyone who wishes to have robust error handling must remember to manually call `flush()` on a `BufWriter` before it is dropped. Until a permanent fix is in place, it seems worthwhile to add a warning to that effect to the documentation.
When using
BufWriter
, it is very easy to unintentionally ignore errors, because errors which occur when flushing buffered data when theBufWriter
is dropped are ignored. This has been noted in a couple places: #32677, #37045.There has been some discussion about how to fix this problem in #32677, but no solution seems likely to land in the near future. For now, anyone who wishes to have robust error handling must remember to manually call
flush()
on aBufWriter
before it is dropped. Until a permanent fix is in place, it seems worthwhile to add a warning to that effect to the documentation.