@@ -200,7 +200,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
200
200
kind : MemoryKind < M :: MemoryKind > ,
201
201
) -> InterpResult < ' static , Pointer < M :: PointerTag > > {
202
202
let alloc = Allocation :: uninit ( size, align, M :: PANIC_ON_ALLOC_FAIL ) ?;
203
- Ok ( self . allocate_with_ptr ( alloc, kind) )
203
+ Ok ( self . allocate_raw_ptr ( alloc, kind) )
204
204
}
205
205
206
206
pub fn allocate_bytes_ptr (
@@ -211,10 +211,10 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
211
211
mutability : Mutability ,
212
212
) -> Pointer < M :: PointerTag > {
213
213
let alloc = Allocation :: from_bytes ( bytes, align, mutability) ;
214
- self . allocate_with_ptr ( alloc, kind)
214
+ self . allocate_raw_ptr ( alloc, kind)
215
215
}
216
216
217
- pub fn allocate_with_ptr (
217
+ pub fn allocate_raw_ptr (
218
218
& mut self ,
219
219
alloc : Allocation ,
220
220
kind : MemoryKind < M :: MemoryKind > ,
@@ -238,7 +238,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
238
238
new_align : Align ,
239
239
kind : MemoryKind < M :: MemoryKind > ,
240
240
) -> InterpResult < ' tcx , Pointer < M :: PointerTag > > {
241
- let ( alloc_id, offset, ptr) = self . ptr_get_alloc ( ptr) ?;
241
+ let ( alloc_id, offset, ptr) = self . ptr_get_alloc_id ( ptr) ?;
242
242
if offset. bytes ( ) != 0 {
243
243
throw_ub_format ! (
244
244
"reallocating {:?} which does not point to the beginning of an object" ,
@@ -274,7 +274,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
274
274
old_size_and_align : Option < ( Size , Align ) > ,
275
275
kind : MemoryKind < M :: MemoryKind > ,
276
276
) -> InterpResult < ' tcx > {
277
- let ( alloc_id, offset, ptr) = self . ptr_get_alloc ( ptr) ?;
277
+ let ( alloc_id, offset, ptr) = self . ptr_get_alloc_id ( ptr) ?;
278
278
trace ! ( "deallocating: {}" , alloc_id) ;
279
279
280
280
if offset. bytes ( ) != 0 {
@@ -419,7 +419,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
419
419
}
420
420
}
421
421
422
- Ok ( match self . ptr_try_get_alloc ( ptr) {
422
+ Ok ( match self . ptr_try_get_alloc_id ( ptr) {
423
423
Err ( addr) => {
424
424
// We couldn't get a proper allocation. This is only okay if the access size is 0,
425
425
// and the address is not null.
@@ -731,7 +731,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
731
731
ptr : Pointer < Option < M :: PointerTag > > ,
732
732
) -> InterpResult < ' tcx , FnVal < ' tcx , M :: ExtraFnVal > > {
733
733
trace ! ( "get_fn({:?})" , ptr) ;
734
- let ( alloc_id, offset, _ptr) = self . ptr_get_alloc ( ptr) ?;
734
+ let ( alloc_id, offset, _ptr) = self . ptr_get_alloc_id ( ptr) ?;
735
735
if offset. bytes ( ) != 0 {
736
736
throw_ub ! ( InvalidFunctionPointer ( Pointer :: new( alloc_id, offset) ) )
737
737
}
@@ -1125,7 +1125,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
1125
1125
Err ( _) => {
1126
1126
// Can only happen during CTFE.
1127
1127
let ptr = self . scalar_to_ptr ( scalar) ;
1128
- match self . ptr_try_get_alloc ( ptr) {
1128
+ match self . ptr_try_get_alloc_id ( ptr) {
1129
1129
Ok ( ( alloc_id, offset, _) ) => {
1130
1130
let ( size, _align) = self
1131
1131
. get_alloc_size_and_align ( alloc_id, AllocCheck :: MaybeDead )
@@ -1142,7 +1142,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
1142
1142
1143
1143
/// Turning a "maybe pointer" into a proper pointer (and some information
1144
1144
/// about where it points), or an absolute address.
1145
- pub fn ptr_try_get_alloc (
1145
+ pub fn ptr_try_get_alloc_id (
1146
1146
& self ,
1147
1147
ptr : Pointer < Option < M :: PointerTag > > ,
1148
1148
) -> Result < ( AllocId , Size , Pointer < M :: PointerTag > ) , u64 > {
@@ -1157,11 +1157,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
1157
1157
1158
1158
/// Turning a "maybe pointer" into a proper pointer (and some information about where it points).
1159
1159
#[ inline( always) ]
1160
- pub fn ptr_get_alloc (
1160
+ pub fn ptr_get_alloc_id (
1161
1161
& self ,
1162
1162
ptr : Pointer < Option < M :: PointerTag > > ,
1163
1163
) -> InterpResult < ' tcx , ( AllocId , Size , Pointer < M :: PointerTag > ) > {
1164
- self . ptr_try_get_alloc ( ptr) . map_err ( |offset| {
1164
+ self . ptr_try_get_alloc_id ( ptr) . map_err ( |offset| {
1165
1165
err_ub ! ( DanglingIntPointer ( offset, CheckInAllocMsg :: InboundsTest ) ) . into ( )
1166
1166
} )
1167
1167
}
0 commit comments