diff options
| author | The8472 <git@infinite-source.de> | 2021-08-05 09:32:41 +0200 |
|---|---|---|
| committer | The8472 <git@infinite-source.de> | 2021-08-05 09:32:41 +0200 |
| commit | f408d4bb8ca382bd981fedb7eb809893271f9859 (patch) | |
| tree | 42269ef51ae8ffebf9e539aa5bdd8d569331b9a0 | |
| parent | 83b01b9f1ac0ee605271286ddb31b6f9701e1f89 (diff) | |
| download | rust-f408d4bb8ca382bd981fedb7eb809893271f9859.tar.gz rust-f408d4bb8ca382bd981fedb7eb809893271f9859.zip | |
use box->vec conversion API that doesn't reallocate
| -rw-r--r-- | compiler/rustc_middle/src/mir/interpret/allocation.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index a503c86c59b..ada6e097766 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -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(), |
