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

Make advance_mut impl of BufMut for Vec<u8> panic if cnt > remaining #377

Merged
merged 1 commit into from Mar 25, 2020

Conversation

TimHambourger
Copy link
Contributor

@TimHambourger TimHambourger commented Mar 13, 2020

Fixes #354.
As suggested here, this PR goes the route of making advance_mut for Vec<u8> panic if cnt > remaining. That's definitely a breaking change: Any consumers that expect some_vec.advance_mut(cnt) to reserve space will need to reserve it themselves in advance instead.

@carllerche
Copy link
Member

I'm neutral on this. I don't think it is necessarily a breaking change as the fn is documented to say that panics can happen. On the other hand, the change isn't critical imo. The fn is already flagged as unsafe and callers should use caution.

So, I could go either way. @seanmonstar ?

@carllerche
Copy link
Member

Oh, if we don't merge this now, we probably should for the next breaking change.

@seanmonstar seanmonstar merged commit b4ebe84 into tokio-rs:master Mar 25, 2020
@TimHambourger TimHambourger deleted the 354_advance_mut_panic branch March 28, 2020 01:30
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 this pull request may close these issues.

advance_mut implementation of BufMut for Vec<u8> seems inconsistent with documentation
3 participants