add a pointer_size method to Memory for easy access

This commit is contained in:
Oliver Schneider
2016-06-23 09:59:16 +02:00
parent 205a988c1b
commit d13153c424
+5 -1
View File
@@ -6,7 +6,7 @@
use rustc::hir::def_id::DefId;
use rustc::ty::BareFnTy;
use rustc::ty::subst::Substs;
use rustc::ty::layout::{Size, TargetDataLayout};
use rustc::ty::layout::TargetDataLayout;
use error::{EvalError, EvalResult};
use primval::PrimVal;
@@ -155,6 +155,10 @@ pub fn deallocate(&mut self, ptr: Pointer) -> EvalResult<'tcx, ()> {
Ok(())
}
pub fn pointer_size(&self) -> usize {
self.layout.pointer_size.bytes() as usize
}
}
/// Allocation accessors