Skip to content

Commit 339e703

Browse files
authored
Merge pull request rust-lang#40 from oli-obk/miri_upstream
things priroda needs to be public or changed
2 parents d309ab7 + b91338b commit 339e703

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

src/interpreter/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
154154
}
155155
}
156156

157-
pub fn memory(&self) -> &Memory {
157+
pub fn memory(&self) -> &Memory<'a, 'tcx> {
158158
&self.memory
159159
}
160160

161161
pub fn memory_mut(&mut self) -> &mut Memory<'a, 'tcx> {
162162
&mut self.memory
163163
}
164164

165-
pub fn stack(&self) -> &[Frame] {
165+
pub fn stack(&self) -> &[Frame<'a, 'tcx>] {
166166
&self.stack
167167
}
168168

@@ -235,7 +235,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
235235
ty.is_sized(self.tcx, &self.tcx.empty_parameter_environment(), DUMMY_SP)
236236
}
237237

238-
fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
238+
pub fn load_mir(&self, def_id: DefId) -> CachedMir<'a, 'tcx> {
239239
match self.tcx.map.as_local_node_id(def_id) {
240240
Some(node_id) => CachedMir::Ref(self.mir_map.map.get(&node_id).unwrap()),
241241
None => {
@@ -255,7 +255,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
255255
}
256256
}
257257

258-
fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
258+
pub fn monomorphize(&self, ty: Ty<'tcx>, substs: &'tcx Substs<'tcx>) -> Ty<'tcx> {
259259
let substituted = ty.subst(self.tcx, substs);
260260
self.tcx.normalize_associated_type(&substituted)
261261
}

src/lib.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,8 @@ pub use interpreter::{
3838
eval_main,
3939
};
4040

41-
pub use memory::Memory;
41+
pub use memory::{
42+
Memory,
43+
Pointer,
44+
AllocId,
45+
};

src/memory.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use primval::PrimVal;
1616
////////////////////////////////////////////////////////////////////////////////
1717

1818
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)]
19-
pub struct AllocId(u64);
19+
pub struct AllocId(pub u64);
2020

2121
impl fmt::Display for AllocId {
2222
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
@@ -77,6 +77,10 @@ impl<'a, 'tcx> Memory<'a, 'tcx> {
7777
}
7878
}
7979

80+
pub fn allocations<'b>(&'b self) -> ::std::collections::hash_map::Iter<'b, AllocId, Allocation> {
81+
self.alloc_map.iter()
82+
}
83+
8084
pub fn create_fn_ptr(&mut self, def_id: DefId, substs: &'tcx Substs<'tcx>, fn_ty: &'tcx BareFnTy<'tcx>) -> Pointer {
8185
let def = FunctionDefinition {
8286
def_id: def_id,
@@ -576,7 +580,7 @@ impl UndefMask {
576580
}
577581

578582
/// Check whether the range `start..end` (end-exclusive) is entirely defined.
579-
fn is_range_defined(&self, start: usize, end: usize) -> bool {
583+
pub fn is_range_defined(&self, start: usize, end: usize) -> bool {
580584
if end > self.len { return false; }
581585
for i in start..end {
582586
if !self.get(i) { return false; }

0 commit comments

Comments
 (0)