@@ -10,8 +10,8 @@ use rustc::mir;
10
10
use rustc:: ty:: { self , TyCtxt } ;
11
11
12
12
use super :: {
13
- Allocation , AllocId , InterpResult , Scalar , AllocationExtra ,
14
- InterpCx , PlaceTy , OpTy , ImmTy , MemoryKind , Pointer , Memory
13
+ Allocation , AllocId , InterpResult , InterpError , Scalar , AllocationExtra ,
14
+ InterpCx , PlaceTy , OpTy , ImmTy , MemoryKind , Pointer , Memory ,
15
15
} ;
16
16
17
17
/// Whether this kind of memory is allowed to leak
@@ -209,17 +209,19 @@ pub trait Machine<'mir, 'tcx>: Sized {
209
209
extra : Self :: FrameExtra ,
210
210
) -> InterpResult < ' tcx > ;
211
211
212
+ #[ inline( always) ]
212
213
fn int_to_ptr (
213
214
_mem : & Memory < ' mir , ' tcx , Self > ,
214
215
int : u64 ,
215
216
) -> InterpResult < ' tcx , Pointer < Self :: PointerTag > > {
216
- if int == 0 {
217
- err ! ( InvalidNullPointerUsage )
217
+ Err ( ( if int == 0 {
218
+ InterpError :: InvalidNullPointerUsage
218
219
} else {
219
- err ! ( ReadBytesAsPointer )
220
- }
220
+ InterpError :: ReadBytesAsPointer
221
+ } ) . into ( ) )
221
222
}
222
223
224
+ #[ inline( always) ]
223
225
fn ptr_to_int (
224
226
_mem : & Memory < ' mir , ' tcx , Self > ,
225
227
_ptr : Pointer < Self :: PointerTag > ,
0 commit comments