From f408d4bb8ca382bd981fedb7eb809893271f9859 Mon Sep 17 00:00:00 2001 From: The8472 Date: Thu, 5 Aug 2021 09:32:41 +0200 Subject: [PATCH] use box->vec conversion API that doesn't reallocate --- compiler/rustc_middle/src/mir/interpret/allocation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 Allocation { })?; // SAFETY: This turns a Box<[MaybeUninit]> into a Vec. 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(),