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

advance_mut implementation of BufMut for Vec<u8> seems inconsistent with documentation #354

Closed
udoprog opened this issue Dec 27, 2019 · 0 comments · Fixed by #377
Closed

Comments

@udoprog
Copy link
Contributor

udoprog commented Dec 27, 2019

The documentation of BufMut::advance_mut states the following about panics:

Panics

This function may panic if cnt > self.remaining_mut().

Implementer notes

It is recommended for implementations of advance_mut to panic if
cnt > self.remaining_mut(). If the implementation does not panic,
the call must behave as if cnt == self.remaining_mut().

A call with cnt == 0 should never panic and be a no-op.

Currently, the impl for Vec<u8> will reserve to accommodate the advance. This seems to be in conflict with If the implementation does not panic, the call must behave as if cnt == self.remaining_mut().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant