Skip to content

Commit 956a3ef

Browse files
committed
more inlining
1 parent 127610b commit 956a3ef

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/librustc_mir/interpret/machine.rs

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

1212
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,
1515
};
1616

1717
/// Whether this kind of memory is allowed to leak
@@ -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)