Skip to content

Commit

Permalink
use box->vec conversion API that doesn't reallocate
Browse files Browse the repository at this point in the history
  • Loading branch information
the8472 committed Aug 5, 2021
1 parent 83b01b9 commit f408d4b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/mir/interpret/allocation.rs
Expand Up @@ -147,7 +147,7 @@ impl<Tag> Allocation<Tag> {
})?;
// SAFETY: This turns a Box<[MaybeUninit<u8>]> into a Vec<u8>. This is safe since the box
// was zero-allocated which is a valid value for u8.
let bytes = unsafe { bytes.assume_init().to_vec() };
let bytes = unsafe { bytes.assume_init().into_vec() };
Ok(Allocation {
bytes,
relocations: Relocations::new(),
Expand Down

0 comments on commit f408d4b

Please sign in to comment.