File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed
compiler/rustc_middle/src/mir/interpret Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -214,8 +214,7 @@ impl<Prov> Allocation<Prov> {
214
214
let layout = std:: alloc:: Layout :: from_size_align ( slice. len ( ) , align_usize) . unwrap ( ) ;
215
215
let bytes = unsafe {
216
216
let buf = std:: alloc:: alloc ( layout) ;
217
- let mut uninit_bytes = Vec :: from_raw_parts ( buf as * mut MaybeUninit < u8 > , slice. len ( ) , slice. len ( ) ) ;
218
- let mut boxed = Box :: < [ MaybeUninit < u8 > ] > :: from_raw ( & mut * uninit_bytes) ;
217
+ let mut boxed = Box :: < [ MaybeUninit < u8 > ] > :: from_raw ( std:: slice:: from_raw_parts_mut ( buf as * mut MaybeUninit < u8 > , slice. len ( ) ) ) ;
219
218
MaybeUninit :: write_slice ( & mut boxed, & slice) ;
220
219
boxed. assume_init ( )
221
220
} ;
@@ -290,8 +289,7 @@ impl Allocation {
290
289
let layout = std:: alloc:: Layout :: from_size_align ( self . bytes . len ( ) , align_usize) . unwrap ( ) ;
291
290
let mut bytes = unsafe {
292
291
let buf = std:: alloc:: alloc ( layout) ;
293
- let mut uninit_bytes = Vec :: from_raw_parts ( buf as * mut MaybeUninit < u8 > , self . bytes . len ( ) , self . bytes . len ( ) ) ;
294
- let mut boxed = Box :: < [ MaybeUninit < u8 > ] > :: from_raw ( & mut * uninit_bytes) ;
292
+ let mut boxed = Box :: < [ MaybeUninit < u8 > ] > :: from_raw ( std:: slice:: from_raw_parts_mut ( buf as * mut MaybeUninit < u8 > , self . bytes . len ( ) ) ) ;
295
293
MaybeUninit :: write_slice ( & mut boxed, & self . bytes ) ;
296
294
boxed. assume_init ( )
297
295
} ;
You can’t perform that action at this time.
0 commit comments