11//! The virtual memory representation of the MIR interpreter.
22
33use super :: {
4- Pointer , EvalResult , AllocId , ScalarMaybeUndef , write_target_uint, read_target_uint, Scalar ,
4+ Pointer , InterpResult , AllocId , ScalarMaybeUndef , write_target_uint, read_target_uint, Scalar ,
55} ;
66
77use crate :: ty:: layout:: { Size , Align } ;
@@ -82,7 +82,7 @@ pub trait AllocationExtra<Tag>: ::std::fmt::Debug + Clone {
8282 _alloc : & Allocation < Tag , Self > ,
8383 _ptr : Pointer < Tag > ,
8484 _size : Size ,
85- ) -> EvalResult < ' tcx > {
85+ ) -> InterpResult < ' tcx > {
8686 Ok ( ( ) )
8787 }
8888
@@ -92,7 +92,7 @@ pub trait AllocationExtra<Tag>: ::std::fmt::Debug + Clone {
9292 _alloc : & mut Allocation < Tag , Self > ,
9393 _ptr : Pointer < Tag > ,
9494 _size : Size ,
95- ) -> EvalResult < ' tcx > {
95+ ) -> InterpResult < ' tcx > {
9696 Ok ( ( ) )
9797 }
9898
@@ -103,7 +103,7 @@ pub trait AllocationExtra<Tag>: ::std::fmt::Debug + Clone {
103103 _alloc : & mut Allocation < Tag , Self > ,
104104 _ptr : Pointer < Tag > ,
105105 _size : Size ,
106- ) -> EvalResult < ' tcx > {
106+ ) -> InterpResult < ' tcx > {
107107 Ok ( ( ) )
108108 }
109109}
@@ -156,7 +156,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
156156 & self ,
157157 ptr : Pointer < Tag > ,
158158 msg : CheckInAllocMsg ,
159- ) -> EvalResult < ' tcx > {
159+ ) -> InterpResult < ' tcx > {
160160 let allocation_size = self . bytes . len ( ) as u64 ;
161161 ptr. check_in_alloc ( Size :: from_bytes ( allocation_size) , msg)
162162 }
@@ -169,7 +169,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
169169 ptr : Pointer < Tag > ,
170170 size : Size ,
171171 msg : CheckInAllocMsg ,
172- ) -> EvalResult < ' tcx > {
172+ ) -> InterpResult < ' tcx > {
173173 // if ptr.offset is in bounds, then so is ptr (because offset checks for overflow)
174174 self . check_bounds_ptr ( ptr. offset ( size, cx) ?, msg)
175175 }
@@ -191,7 +191,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
191191 size : Size ,
192192 check_defined_and_ptr : bool ,
193193 msg : CheckInAllocMsg ,
194- ) -> EvalResult < ' tcx , & [ u8 ] >
194+ ) -> InterpResult < ' tcx , & [ u8 ] >
195195 {
196196 self . check_bounds ( cx, ptr, size, msg) ?;
197197
@@ -217,7 +217,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
217217 cx : & impl HasDataLayout ,
218218 ptr : Pointer < Tag > ,
219219 size : Size ,
220- ) -> EvalResult < ' tcx , & [ u8 ] >
220+ ) -> InterpResult < ' tcx , & [ u8 ] >
221221 {
222222 self . get_bytes_internal ( cx, ptr, size, true , CheckInAllocMsg :: MemoryAccessTest )
223223 }
@@ -230,7 +230,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
230230 cx : & impl HasDataLayout ,
231231 ptr : Pointer < Tag > ,
232232 size : Size ,
233- ) -> EvalResult < ' tcx , & [ u8 ] >
233+ ) -> InterpResult < ' tcx , & [ u8 ] >
234234 {
235235 self . get_bytes_internal ( cx, ptr, size, false , CheckInAllocMsg :: MemoryAccessTest )
236236 }
@@ -242,7 +242,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
242242 cx : & impl HasDataLayout ,
243243 ptr : Pointer < Tag > ,
244244 size : Size ,
245- ) -> EvalResult < ' tcx , & mut [ u8 ] >
245+ ) -> InterpResult < ' tcx , & mut [ u8 ] >
246246 {
247247 assert_ne ! ( size. bytes( ) , 0 , "0-sized accesses should never even get a `Pointer`" ) ;
248248 self . check_bounds ( cx, ptr, size, CheckInAllocMsg :: MemoryAccessTest ) ?;
@@ -267,7 +267,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
267267 & self ,
268268 cx : & impl HasDataLayout ,
269269 ptr : Pointer < Tag > ,
270- ) -> EvalResult < ' tcx , & [ u8 ] >
270+ ) -> InterpResult < ' tcx , & [ u8 ] >
271271 {
272272 assert_eq ! ( ptr. offset. bytes( ) as usize as u64 , ptr. offset. bytes( ) ) ;
273273 let offset = ptr. offset . bytes ( ) as usize ;
@@ -292,7 +292,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
292292 ptr : Pointer < Tag > ,
293293 size : Size ,
294294 allow_ptr_and_undef : bool ,
295- ) -> EvalResult < ' tcx >
295+ ) -> InterpResult < ' tcx >
296296 {
297297 // Check bounds and relocations on the edges
298298 self . get_bytes_with_undef_and_ptr ( cx, ptr, size) ?;
@@ -312,7 +312,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
312312 cx : & impl HasDataLayout ,
313313 ptr : Pointer < Tag > ,
314314 src : & [ u8 ] ,
315- ) -> EvalResult < ' tcx >
315+ ) -> InterpResult < ' tcx >
316316 {
317317 let bytes = self . get_bytes_mut ( cx, ptr, Size :: from_bytes ( src. len ( ) as u64 ) ) ?;
318318 bytes. clone_from_slice ( src) ;
@@ -326,7 +326,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
326326 ptr : Pointer < Tag > ,
327327 val : u8 ,
328328 count : Size
329- ) -> EvalResult < ' tcx >
329+ ) -> InterpResult < ' tcx >
330330 {
331331 let bytes = self . get_bytes_mut ( cx, ptr, count) ?;
332332 for b in bytes {
@@ -348,7 +348,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
348348 cx : & impl HasDataLayout ,
349349 ptr : Pointer < Tag > ,
350350 size : Size
351- ) -> EvalResult < ' tcx , ScalarMaybeUndef < Tag > >
351+ ) -> InterpResult < ' tcx , ScalarMaybeUndef < Tag > >
352352 {
353353 // get_bytes_unchecked tests relocation edges
354354 let bytes = self . get_bytes_with_undef_and_ptr ( cx, ptr, size) ?;
@@ -383,7 +383,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
383383 & self ,
384384 cx : & impl HasDataLayout ,
385385 ptr : Pointer < Tag > ,
386- ) -> EvalResult < ' tcx , ScalarMaybeUndef < Tag > >
386+ ) -> InterpResult < ' tcx , ScalarMaybeUndef < Tag > >
387387 {
388388 self . read_scalar ( cx, ptr, cx. data_layout ( ) . pointer_size )
389389 }
@@ -402,7 +402,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
402402 ptr : Pointer < Tag > ,
403403 val : ScalarMaybeUndef < Tag > ,
404404 type_size : Size ,
405- ) -> EvalResult < ' tcx >
405+ ) -> InterpResult < ' tcx >
406406 {
407407 let val = match val {
408408 ScalarMaybeUndef :: Scalar ( scalar) => scalar,
@@ -438,7 +438,7 @@ impl<'tcx, Tag: Copy, Extra: AllocationExtra<Tag>> Allocation<Tag, Extra> {
438438 cx : & impl HasDataLayout ,
439439 ptr : Pointer < Tag > ,
440440 val : ScalarMaybeUndef < Tag >
441- ) -> EvalResult < ' tcx >
441+ ) -> InterpResult < ' tcx >
442442 {
443443 let ptr_size = cx. data_layout ( ) . pointer_size ;
444444 self . write_scalar ( cx, ptr. into ( ) , val, ptr_size)
@@ -468,7 +468,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
468468 cx : & impl HasDataLayout ,
469469 ptr : Pointer < Tag > ,
470470 size : Size ,
471- ) -> EvalResult < ' tcx > {
471+ ) -> InterpResult < ' tcx > {
472472 if self . relocations ( cx, ptr, size) . is_empty ( ) {
473473 Ok ( ( ) )
474474 } else {
@@ -487,7 +487,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
487487 cx : & impl HasDataLayout ,
488488 ptr : Pointer < Tag > ,
489489 size : Size ,
490- ) -> EvalResult < ' tcx > {
490+ ) -> InterpResult < ' tcx > {
491491 // Find the start and end of the given range and its outermost relocations.
492492 let ( first, last) = {
493493 // Find all relocations overlapping the given range.
@@ -525,7 +525,7 @@ impl<'tcx, Tag: Copy, Extra> Allocation<Tag, Extra> {
525525 cx : & impl HasDataLayout ,
526526 ptr : Pointer < Tag > ,
527527 size : Size ,
528- ) -> EvalResult < ' tcx > {
528+ ) -> InterpResult < ' tcx > {
529529 self . check_relocations ( cx, ptr, Size :: ZERO ) ?;
530530 self . check_relocations ( cx, ptr. offset ( size, cx) ?, Size :: ZERO ) ?;
531531 Ok ( ( ) )
@@ -538,7 +538,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
538538 /// Checks that a range of bytes is defined. If not, returns the `ReadUndefBytes`
539539 /// error which will report the first byte which is undefined.
540540 #[ inline]
541- fn check_defined ( & self , ptr : Pointer < Tag > , size : Size ) -> EvalResult < ' tcx > {
541+ fn check_defined ( & self , ptr : Pointer < Tag > , size : Size ) -> InterpResult < ' tcx > {
542542 self . undef_mask . is_range_defined (
543543 ptr. offset ,
544544 ptr. offset + size,
@@ -550,7 +550,7 @@ impl<'tcx, Tag, Extra> Allocation<Tag, Extra> {
550550 ptr : Pointer < Tag > ,
551551 size : Size ,
552552 new_state : bool ,
553- ) -> EvalResult < ' tcx > {
553+ ) -> InterpResult < ' tcx > {
554554 if size. bytes ( ) == 0 {
555555 return Ok ( ( ) ) ;
556556 }
0 commit comments