Merge pull request #40 from oli-obk/miri_upstream

things priroda needs to be public or changed
This commit is contained in:
Scott Olson
2016-06-30 04:40:43 -05:00
committed by GitHub
3 changed files with 15 additions and 7 deletions
+4 -4
View File
@@ -154,7 +154,7 @@ pub fn alloc_ret_ptr(&mut self, output_ty: ty::FnOutput<'tcx>, substs: &'tcx Sub
}
}
pub fn memory(&self) -> &Memory {
pub fn memory(&self) -> &Memory<'a, 'tcx> {
&self.memory
}
@@ -162,7 +162,7 @@ pub fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx> {
&mut self.memory
}
pub fn stack(&self) -> &[Frame] {
pub fn stack(&self) -> &[Frame<'a, 'tcx>] {
&self.stack
}
@@ -235,7 +235,7 @@ fn type_is_sized(&self, ty: Ty<'tcx>) -> bool {
ty.is_sized(self.tcx, &self.tcx.empty_parameter_environment(), DUMMY_SP)
}
fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
pub fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
match self.tcx.map.as_local_node_id(def_id) {
Some(node_id) => CachedMir::Ref(self.mir_map.map.get(&node_id).unwrap()),
None => {
@@ -255,7 +255,7 @@ fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
}
}
fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
pub fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
let substituted = ty.subst(self.tcx, substs);
self.tcx.normalize_associated_type(&substituted)
}
+5 -1
View File
@@ -38,4 +38,8 @@
eval_main,
};
pub use memory::Memory;
pub use memory::{
Memory,
Pointer,
AllocId,
};
+6 -2
View File
@@ -16,7 +16,7 @@
////////////////////////////////////////////////////////////////////////////////
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
pub struct AllocId(u64);
pub struct AllocId(pub u64);
impl fmt::Display for AllocId {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -77,6 +77,10 @@ pub fn new(layout: &'a TargetDataLayout) -> Self {
}
}
pub fn allocations<'b>(&'b self) -> ::std::collections::hash_map::Iter<'b, AllocId, Allocation> {
self.alloc_map.iter()
}
pub fn create_fn_ptr(&mut self, def_id: DefId, substs: &'tcx Substs<'tcx>, fn_ty: &'tcx BareFnTy<'tcx>) -> Pointer {
let def = FunctionDefinition {
def_id: def_id,
@@ -576,7 +580,7 @@ fn new(size: usize) -> Self {
}
/// Check whether the range `start..end` (end-exclusive) is entirely defined.
fn is_range_defined(&self, start: usize, end: usize) -> bool {
pub fn is_range_defined(&self, start: usize, end: usize) -> bool {
if end > self.len { return false; }
for i in start..end {
if !self.get(i) { return false; }