Skip to content

Commit 3408713

Browse files
committed
more inlining
1 parent da3dd71 commit 3408713

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/librustc_mir/interpret/machine.rs

+7-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc::mir;
1010
use rustc::ty::{self, TyCtxt};
1111

1212
use super::{
13-
Allocation, AllocId, InterpResult, Scalar, AllocationExtra,
13+
Allocation, AllocId, InterpResult, InterpError, Scalar, AllocationExtra,
1414
InterpretCx, PlaceTy, OpTy, ImmTy, MemoryKind, Pointer, Memory
1515
};
1616

@@ -209,17 +209,19 @@ pub trait Machine<'mir, 'tcx>: Sized {
209209
extra: Self::FrameExtra,
210210
) -> InterpResult<'tcx>;
211211

212+
#[inline(always)]
212213
fn int_to_ptr(
213214
_mem: &Memory<'mir, 'tcx, Self>,
214215
int: u64,
215216
) -> InterpResult<'tcx, Pointer<Self::PointerTag>> {
216-
if int == 0 {
217-
err!(InvalidNullPointerUsage)
217+
Err((if int == 0 {
218+
InterpError::InvalidNullPointerUsage
218219
} else {
219-
err!(ReadBytesAsPointer)
220-
}
220+
InterpError::ReadBytesAsPointer
221+
}).into())
221222
}
222223

224+
#[inline(always)]
223225
fn ptr_to_int(
224226
_mem: &Memory<'mir, 'tcx, Self>,
225227
_ptr: Pointer<Self::PointerTag>,

0 commit comments

Comments
 (0)