-
Notifications
You must be signed in to change notification settings - Fork 278
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
Fix chain remaining_mut(), allowing to chain growing buffer #488
Fix chain remaining_mut(), allowing to chain growing buffer #488
Conversation
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.
Thanks for the PR and sorry for the late review!
I tend to favor this, but, I would like to hear others' opinions.
cc @carllerche @seanmonstar @Darksonn: Do you think it's ok to allow remaining_mut to return less value than it actually is? (in the cases it is greater than the usize::MAX, or in all cases?)
- There is currently no documentation about it.
- This is not allowed in the upper bound of the iterator's size_hint. (Add
ExactSizeIterator
impl foriter::Chain
rust-lang/rust#66531)
Due to #501 I am no longer sure if this PR still useful. To cause overflow now you will need to chain fixed buffer with 2 vectors(or Vec with 2 more), which is very unlikely. |
I think it is fine to allow |
Stumbled upon panic when was trying to chain fixed buffer with growing buffer.
Fixed
remaining_mut
for chain, so you can chain growing buffer.There is workaround for this, so I am not sure if this is intended or not.
But I decided to fix it, because I think this workaround is inconvenient.
Only potential problem is:
Calls to
remaining_mut
can return same value (usize::MAX
) before and after write to buffer.