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> {
214214 let layout = std:: alloc:: Layout :: from_size_align ( slice. len ( ) , align_usize) . unwrap ( ) ;
215215 let bytes = unsafe {
216216 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 ( ) ) ) ;
219218 MaybeUninit :: write_slice ( & mut boxed, & slice) ;
220219 boxed. assume_init ( )
221220 } ;
@@ -290,8 +289,7 @@ impl Allocation {
290289 let layout = std:: alloc:: Layout :: from_size_align ( self . bytes . len ( ) , align_usize) . unwrap ( ) ;
291290 let mut bytes = unsafe {
292291 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 ( ) ) ) ;
295293 MaybeUninit :: write_slice ( & mut boxed, & self . bytes ) ;
296294 boxed. assume_init ( )
297295 } ;
You can’t perform that action at this time.
0 commit comments