diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/bytes_mut.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bytes_mut.rs b/src/bytes_mut.rs index 88d7f00..cc1a3ba 100644 --- a/src/bytes_mut.rs +++ b/src/bytes_mut.rs @@ -646,7 +646,7 @@ impl BytesMut { self.cap = v.capacity(); } else { // calculate offset - let off = v.capacity() - self.cap; + let off = (self.ptr.as_ptr() as usize) - (v.as_ptr() as usize); // new_cap is calculated in terms of `BytesMut`, not the underlying // `Vec`, so it does not take the offset into account. |