diff options
| author | Ralf Jung <post@ralfj.de> | 2019-07-02 10:48:51 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2019-07-04 10:39:05 +0200 |
| commit | 956a3ef3bb64dd75bd9e680c199bee013c00fe4a (patch) | |
| tree | 5ce0d7dd9a75b3c0c3cf0487fb7871b39bdda47e /src | |
| parent | 127610b7c4d4c4bd2c2e4dd4b62640a2cdc41f14 (diff) | |
| download | rust-956a3ef3bb64dd75bd9e680c199bee013c00fe4a.tar.gz rust-956a3ef3bb64dd75bd9e680c199bee013c00fe4a.zip | |
more inlining
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_mir/interpret/machine.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index f283cacb792..24d882b8b46 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -10,8 +10,8 @@ use rustc::mir; use rustc::ty::{self, TyCtxt}; use super::{ - Allocation, AllocId, InterpResult, Scalar, AllocationExtra, - InterpCx, PlaceTy, OpTy, ImmTy, MemoryKind, Pointer, Memory + Allocation, AllocId, InterpResult, InterpError, Scalar, AllocationExtra, + InterpCx, PlaceTy, OpTy, ImmTy, MemoryKind, Pointer, Memory, }; /// Whether this kind of memory is allowed to leak @@ -209,17 +209,19 @@ pub trait Machine<'mir, 'tcx>: Sized { extra: Self::FrameExtra, ) -> InterpResult<'tcx>; + #[inline(always)] fn int_to_ptr( _mem: &Memory<'mir, 'tcx, Self>, int: u64, ) -> InterpResult<'tcx, Pointer<Self::PointerTag>> { - if int == 0 { - err!(InvalidNullPointerUsage) + Err((if int == 0 { + InterpError::InvalidNullPointerUsage } else { - err!(ReadBytesAsPointer) - } + InterpError::ReadBytesAsPointer + }).into()) } + #[inline(always)] fn ptr_to_int( _mem: &Memory<'mir, 'tcx, Self>, _ptr: Pointer<Self::PointerTag>, |
