Skip to content

Commit

Permalink
use ManuallyDrop instead of mem-forget-in-disguise
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Dec 31, 2020
1 parent 27a0f9c commit 8881cfd
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,8 +806,7 @@ impl From<Vec<u8>> for Bytes {

let slice = vec.into_boxed_slice();
let len = slice.len();
let ptr = slice.as_ptr();
drop(Box::into_raw(slice));
let ptr = Box::into_raw(slice) as *mut u8;

if ptr as usize & 0x1 == 0 {
let data = ptr as usize | KIND_VEC;
Expand Down

0 comments on commit 8881cfd

Please sign in to comment.