@@ -626,7 +626,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
626
626
627
627
match & path[ ..] {
628
628
// Allocators are magic. They have no MIR, even when the rest of libstd does.
629
- "alloc::heap ::::__rust_alloc" => {
629
+ "alloc::alloc ::::__rust_alloc" => {
630
630
let size = self . value_to_primval ( args[ 0 ] ) ?. to_u64 ( ) ?;
631
631
let align = self . value_to_primval ( args[ 1 ] ) ?. to_u64 ( ) ?;
632
632
if size == 0 {
@@ -640,7 +640,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
640
640
Some ( MemoryKind :: Rust . into ( ) ) ) ?;
641
641
self . write_primval ( dest, PrimVal :: Ptr ( ptr) , dest_ty) ?;
642
642
}
643
- "alloc::heap ::::__rust_alloc_zeroed" => {
643
+ "alloc::alloc ::::__rust_alloc_zeroed" => {
644
644
let size = self . value_to_primval ( args[ 0 ] ) ?. to_u64 ( ) ?;
645
645
let align = self . value_to_primval ( args[ 1 ] ) ?. to_u64 ( ) ?;
646
646
if size == 0 {
@@ -655,7 +655,7 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
655
655
self . memory . write_repeat ( ptr. into ( ) , 0 , size) ?;
656
656
self . write_primval ( dest, PrimVal :: Ptr ( ptr) , dest_ty) ?;
657
657
}
658
- "alloc::heap ::::__rust_dealloc" => {
658
+ "alloc::alloc ::::__rust_dealloc" => {
659
659
let ptr = self . into_ptr ( args[ 0 ] . value ) ?. to_ptr ( ) ?;
660
660
let old_size = self . value_to_primval ( args[ 1 ] ) ?. to_u64 ( ) ?;
661
661
let align = self . value_to_primval ( args[ 2 ] ) ?. to_u64 ( ) ?;
@@ -671,27 +671,23 @@ impl<'a, 'mir, 'tcx: 'mir + 'a> EvalContextExt<'tcx> for EvalContext<'a, 'mir, '
671
671
MemoryKind :: Rust . into ( ) ,
672
672
) ?;
673
673
}
674
- "alloc::heap ::::__rust_realloc" => {
674
+ "alloc::alloc ::::__rust_realloc" => {
675
675
let ptr = self . into_ptr ( args[ 0 ] . value ) ?. to_ptr ( ) ?;
676
676
let old_size = self . value_to_primval ( args[ 1 ] ) ?. to_u64 ( ) ?;
677
- let old_align = self . value_to_primval ( args[ 2 ] ) ?. to_u64 ( ) ?;
677
+ let align = self . value_to_primval ( args[ 2 ] ) ?. to_u64 ( ) ?;
678
678
let new_size = self . value_to_primval ( args[ 3 ] ) ?. to_u64 ( ) ?;
679
- let new_align = self . value_to_primval ( args[ 4 ] ) ?. to_u64 ( ) ?;
680
679
if old_size == 0 || new_size == 0 {
681
680
return err ! ( HeapAllocZeroBytes ) ;
682
681
}
683
- if !old_align. is_power_of_two ( ) {
684
- return err ! ( HeapAllocNonPowerOfTwoAlignment ( old_align) ) ;
685
- }
686
- if !new_align. is_power_of_two ( ) {
687
- return err ! ( HeapAllocNonPowerOfTwoAlignment ( new_align) ) ;
682
+ if !align. is_power_of_two ( ) {
683
+ return err ! ( HeapAllocNonPowerOfTwoAlignment ( align) ) ;
688
684
}
689
685
let new_ptr = self . memory . reallocate (
690
686
ptr,
691
687
old_size,
692
- Align :: from_bytes ( old_align , old_align ) . unwrap ( ) ,
688
+ Align :: from_bytes ( align , align ) . unwrap ( ) ,
693
689
new_size,
694
- Align :: from_bytes ( new_align , new_align ) . unwrap ( ) ,
690
+ Align :: from_bytes ( align , align ) . unwrap ( ) ,
695
691
MemoryKind :: Rust . into ( ) ,
696
692
) ?;
697
693
self . write_primval ( dest, PrimVal :: Ptr ( new_ptr) , dest_ty) ?;
0 commit comments