mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 22:18:23 +03:00
add a pointer_size method to Memory for easy access
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user