Uh oh!
There was an error while loading. Please reload this page.
Implement Seek::stream_position() for BufReader - #74366
Conversation
rust-highfive
commented
Jul 15, 2020
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
LukasKalbertodt
left a comment
There was a problem hiding this comment.
Looks mostly good to me! Only thing I noticed is that the subtraction might underflow if the inner reader has a buggy stream_position implementation. Not sure if we really need to harden against that. But I think I would prefer, for now, if you could replace the subtraction with:
pos.checked_sub(...).expect("buggy `stream_position` implementation in inner reader of BufReader")Or something like that.
Uh oh!
There was an error while loading. Please reload this page.
t-rapp
commented
Aug 13, 2020
Updated the implementation to check for subtraction underflow / overflow. Realized that besides a buggy inner reader, this situation can also occur when misusing the (unfortunately public) |
kennytm
commented
Aug 13, 2020
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
LukasKalbertodt
left a comment
There was a problem hiding this comment.
Sorry for the delay. But looks almost ready to merge now! Just a tiny thing I noticed.
Uh oh!
There was an error while loading. Please reload this page.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
LukasKalbertodt
left a comment
There was a problem hiding this comment.
Oops, I found another minor thing °_°
Sorry for not noticing that in my last review.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
LukasKalbertodt
commented
Sep 7, 2020
Looks good to me! @bors r+ Thanks for sticking with this PR for so long! :) |
bors
commented
Sep 7, 2020
📌 Commit 246d327 has been approved by |
bors
commented
Sep 7, 2020
bors
commented
Sep 7, 2020
☀️ Test successful - checks-actions, checks-azure |
Optimization over
BufReader::seek()for getting the current position without flushing the internal buffer.Related to #31100. Based on the code in #70577.