Skip to content

Commit 2448e9d

Browse files
authored
Merge pull request #765 from RalfJung/rustup
rustup for EvalResult rename
2 parents 6ab0147 + d6bcfc5 commit 2448e9d

File tree

8 files changed

+59
-59
lines changed

8 files changed

+59
-59
lines changed

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7cdaffd7962c4aae0cadd82baa241901b03f9458
1+
5c45343f11fbf93cf4e15568aee3ff3f2f287466

src/fn_call.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
1717
args: &[OpTy<'tcx, Tag>],
1818
dest: Option<PlaceTy<'tcx, Tag>>,
1919
ret: Option<mir::BasicBlock>,
20-
) -> EvalResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
20+
) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
2121
let this = self.eval_context_mut();
2222
trace!("eval_fn_call: {:#?}, {:?}", instance, dest.map(|place| *place));
2323

@@ -76,7 +76,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
7676
fn free(
7777
&mut self,
7878
ptr: Scalar<Tag>,
79-
) -> EvalResult<'tcx> {
79+
) -> InterpResult<'tcx> {
8080
let this = self.eval_context_mut();
8181
if !ptr.is_null_ptr(this) {
8282
this.memory_mut().deallocate(
@@ -92,7 +92,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
9292
&mut self,
9393
old_ptr: Scalar<Tag>,
9494
new_size: u64,
95-
) -> EvalResult<'tcx, Scalar<Tag>> {
95+
) -> InterpResult<'tcx, Scalar<Tag>> {
9696
let this = self.eval_context_mut();
9797
let align = this.tcx.data_layout.pointer_align.abi;
9898
if old_ptr.is_null_ptr(this) {
@@ -139,7 +139,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
139139
args: &[OpTy<'tcx, Tag>],
140140
dest: Option<PlaceTy<'tcx, Tag>>,
141141
ret: Option<mir::BasicBlock>,
142-
) -> EvalResult<'tcx> {
142+
) -> InterpResult<'tcx> {
143143
let this = self.eval_context_mut();
144144
let attrs = this.tcx.get_attrs(def_id);
145145
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
@@ -895,13 +895,13 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
895895
Ok(())
896896
}
897897

898-
fn write_null(&mut self, dest: PlaceTy<'tcx, Tag>) -> EvalResult<'tcx> {
898+
fn write_null(&mut self, dest: PlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
899899
self.eval_context_mut().write_scalar(Scalar::from_int(0, dest.layout.size), dest)
900900
}
901901

902902
/// Evaluates the scalar at the specified path. Returns Some(val)
903903
/// if the path could be resolved, and None otherwise
904-
fn eval_path_scalar(&mut self, path: &[&str]) -> EvalResult<'tcx, Option<ScalarMaybeUndef<Tag>>> {
904+
fn eval_path_scalar(&mut self, path: &[&str]) -> InterpResult<'tcx, Option<ScalarMaybeUndef<Tag>>> {
905905
let this = self.eval_context_mut();
906906
if let Ok(instance) = this.resolve_path(path) {
907907
let cid = GlobalId {
@@ -920,7 +920,7 @@ fn gen_random<'a, 'mir, 'tcx>(
920920
this: &mut MiriEvalContext<'a, 'mir, 'tcx>,
921921
len: usize,
922922
dest: Scalar<Tag>,
923-
) -> EvalResult<'tcx> {
923+
) -> InterpResult<'tcx> {
924924
if len == 0 {
925925
// Nothing to do
926926
return Ok(());

src/helpers.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'a, 'mir, 'tcx> for crate::MiriEvalContext<'
99

1010
pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'a, 'mir, 'tcx> {
1111
/// Gets an instance for a path.
12-
fn resolve_path(&self, path: &[&str]) -> EvalResult<'tcx, ty::Instance<'tcx>> {
12+
fn resolve_path(&self, path: &[&str]) -> InterpResult<'tcx, ty::Instance<'tcx>> {
1313
let this = self.eval_context_ref();
1414
this.tcx
1515
.crates()
@@ -49,8 +49,8 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
4949
&self,
5050
place: MPlaceTy<'tcx, Tag>,
5151
size: Size,
52-
mut action: impl FnMut(Pointer<Tag>, Size, bool) -> EvalResult<'tcx>,
53-
) -> EvalResult<'tcx> {
52+
mut action: impl FnMut(Pointer<Tag>, Size, bool) -> InterpResult<'tcx>,
53+
) -> InterpResult<'tcx> {
5454
let this = self.eval_context_ref();
5555
trace!("visit_frozen(place={:?}, size={:?})", *place, size);
5656
debug_assert_eq!(size,
@@ -120,7 +120,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
120120
/// Visiting the memory covered by a `MemPlace`, being aware of
121121
/// whether we are inside an `UnsafeCell` or not.
122122
struct UnsafeCellVisitor<'ecx, 'a, 'mir, 'tcx, F>
123-
where F: FnMut(MPlaceTy<'tcx, Tag>) -> EvalResult<'tcx>
123+
where F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
124124
{
125125
ecx: &'ecx MiriEvalContext<'a, 'mir, 'tcx>,
126126
unsafe_cell_action: F,
@@ -131,7 +131,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
131131
for
132132
UnsafeCellVisitor<'ecx, 'a, 'mir, 'tcx, F>
133133
where
134-
F: FnMut(MPlaceTy<'tcx, Tag>) -> EvalResult<'tcx>
134+
F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
135135
{
136136
type V = MPlaceTy<'tcx, Tag>;
137137

@@ -141,7 +141,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
141141
}
142142

143143
// Hook to detect `UnsafeCell`.
144-
fn visit_value(&mut self, v: MPlaceTy<'tcx, Tag>) -> EvalResult<'tcx>
144+
fn visit_value(&mut self, v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
145145
{
146146
trace!("UnsafeCellVisitor: {:?} {:?}", *v, v.layout.ty);
147147
let is_unsafe_cell = match v.layout.ty.sty {
@@ -164,8 +164,8 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
164164
fn visit_aggregate(
165165
&mut self,
166166
place: MPlaceTy<'tcx, Tag>,
167-
fields: impl Iterator<Item=EvalResult<'tcx, MPlaceTy<'tcx, Tag>>>,
168-
) -> EvalResult<'tcx> {
167+
fields: impl Iterator<Item=InterpResult<'tcx, MPlaceTy<'tcx, Tag>>>,
168+
) -> InterpResult<'tcx> {
169169
match place.layout.fields {
170170
layout::FieldPlacement::Array { .. } => {
171171
// For the array layout, we know the iterator will yield sorted elements so
@@ -174,7 +174,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
174174
}
175175
layout::FieldPlacement::Arbitrary { .. } => {
176176
// Gather the subplaces and sort them before visiting.
177-
let mut places = fields.collect::<EvalResult<'tcx, Vec<MPlaceTy<'tcx, Tag>>>>()?;
177+
let mut places = fields.collect::<InterpResult<'tcx, Vec<MPlaceTy<'tcx, Tag>>>>()?;
178178
places.sort_by_key(|place| place.ptr.get_ptr_offset(self.ecx()));
179179
self.walk_aggregate(place, places.into_iter().map(Ok))
180180
}
@@ -186,7 +186,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
186186
}
187187

188188
// We have to do *something* for unions.
189-
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>) -> EvalResult<'tcx>
189+
fn visit_union(&mut self, v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
190190
{
191191
// With unions, we fall back to whatever the type says, to hopefully be consistent
192192
// with LLVM IR.
@@ -200,7 +200,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
200200
}
201201

202202
// We should never get to a primitive, but always short-circuit somewhere above.
203-
fn visit_primitive(&mut self, _v: MPlaceTy<'tcx, Tag>) -> EvalResult<'tcx>
203+
fn visit_primitive(&mut self, _v: MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>
204204
{
205205
bug!("we should always short-circuit before coming to a primitive")
206206
}

src/intrinsic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use rustc::mir;
2-
use rustc::mir::interpret::{EvalResult, PointerArithmetic};
2+
use rustc::mir::interpret::{InterpResult, PointerArithmetic};
33
use rustc::ty::layout::{self, LayoutOf, Size};
44
use rustc::ty;
55

@@ -15,7 +15,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a+'mir>: crate::MiriEvalContextExt<'a,
1515
instance: ty::Instance<'tcx>,
1616
args: &[OpTy<'tcx, Tag>],
1717
dest: PlaceTy<'tcx, Tag>,
18-
) -> EvalResult<'tcx> {
18+
) -> InterpResult<'tcx> {
1919
let this = self.eval_context_mut();
2020
if this.emulate_intrinsic(instance, args, dest)? {
2121
return Ok(());

src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ pub fn create_ecx<'a, 'mir: 'a, 'tcx: 'mir>(
7575
tcx: TyCtxt<'a, 'tcx, 'tcx>,
7676
main_id: DefId,
7777
config: MiriConfig,
78-
) -> EvalResult<'tcx, InterpretCx<'a, 'mir, 'tcx, Evaluator<'tcx>>> {
78+
) -> InterpResult<'tcx, InterpretCx<'a, 'mir, 'tcx, Evaluator<'tcx>>> {
7979
let mut ecx = InterpretCx::new(
8080
tcx.at(syntax::source_map::DUMMY_SP),
8181
ty::ParamEnv::reveal_all(),
@@ -225,7 +225,7 @@ pub fn eval_main<'a, 'tcx: 'a>(
225225
};
226226

227227
// Perform the main execution.
228-
let res: EvalResult = (|| {
228+
let res: InterpResult = (|| {
229229
ecx.run()?;
230230
ecx.run_tls_dtors()
231231
})();
@@ -407,7 +407,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
407407
args: &[OpTy<'tcx, Tag>],
408408
dest: Option<PlaceTy<'tcx, Tag>>,
409409
ret: Option<mir::BasicBlock>,
410-
) -> EvalResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
410+
) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
411411
ecx.find_fn(instance, args, dest, ret)
412412
}
413413

@@ -417,7 +417,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
417417
instance: ty::Instance<'tcx>,
418418
args: &[OpTy<'tcx, Tag>],
419419
dest: PlaceTy<'tcx, Tag>,
420-
) -> EvalResult<'tcx> {
420+
) -> InterpResult<'tcx> {
421421
ecx.call_intrinsic(instance, args, dest)
422422
}
423423

@@ -427,14 +427,14 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
427427
bin_op: mir::BinOp,
428428
left: ImmTy<'tcx, Tag>,
429429
right: ImmTy<'tcx, Tag>,
430-
) -> EvalResult<'tcx, (Scalar<Tag>, bool)> {
430+
) -> InterpResult<'tcx, (Scalar<Tag>, bool)> {
431431
ecx.ptr_op(bin_op, left, right)
432432
}
433433

434434
fn box_alloc(
435435
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
436436
dest: PlaceTy<'tcx, Tag>,
437-
) -> EvalResult<'tcx> {
437+
) -> InterpResult<'tcx> {
438438
trace!("box_alloc for {:?}", dest.layout.ty);
439439
// Call the `exchange_malloc` lang item.
440440
let malloc = ecx.tcx.lang_items().exchange_malloc_fn().unwrap();
@@ -476,7 +476,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
476476
fn find_foreign_static(
477477
def_id: DefId,
478478
tcx: TyCtxtAt<'a, 'tcx, 'tcx>,
479-
) -> EvalResult<'tcx, Cow<'tcx, Allocation>> {
479+
) -> InterpResult<'tcx, Cow<'tcx, Allocation>> {
480480
let attrs = tcx.get_attrs(def_id);
481481
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
482482
Some(name) => name.as_str(),
@@ -498,7 +498,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
498498
}
499499

500500
#[inline(always)]
501-
fn before_terminator(_ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> EvalResult<'tcx>
501+
fn before_terminator(_ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>) -> InterpResult<'tcx>
502502
{
503503
// We are not interested in detecting loops.
504504
Ok(())
@@ -553,7 +553,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
553553
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
554554
kind: mir::RetagKind,
555555
place: PlaceTy<'tcx, Tag>,
556-
) -> EvalResult<'tcx> {
556+
) -> InterpResult<'tcx> {
557557
if !ecx.tcx.sess.opts.debugging_opts.mir_emit_retag || !Self::enforce_validity(ecx) {
558558
// No tracking, or no retagging. The latter is possible because a dependency of ours
559559
// might be called with different flags than we are, so there are `Retag`
@@ -569,15 +569,15 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
569569
#[inline(always)]
570570
fn stack_push(
571571
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
572-
) -> EvalResult<'tcx, stacked_borrows::CallId> {
572+
) -> InterpResult<'tcx, stacked_borrows::CallId> {
573573
Ok(ecx.memory().extra.borrow_mut().new_call())
574574
}
575575

576576
#[inline(always)]
577577
fn stack_pop(
578578
ecx: &mut InterpretCx<'a, 'mir, 'tcx, Self>,
579579
extra: stacked_borrows::CallId,
580-
) -> EvalResult<'tcx> {
580+
) -> InterpResult<'tcx> {
581581
Ok(ecx.memory().extra.borrow_mut().end_call(extra))
582582
}
583583
}

src/operator.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,28 @@ pub trait EvalContextExt<'tcx> {
99
bin_op: mir::BinOp,
1010
left: ImmTy<'tcx, Tag>,
1111
right: ImmTy<'tcx, Tag>,
12-
) -> EvalResult<'tcx, (Scalar<Tag>, bool)>;
12+
) -> InterpResult<'tcx, (Scalar<Tag>, bool)>;
1313

1414
fn ptr_int_arithmetic(
1515
&self,
1616
bin_op: mir::BinOp,
1717
left: Pointer<Tag>,
1818
right: u128,
1919
signed: bool,
20-
) -> EvalResult<'tcx, (Scalar<Tag>, bool)>;
20+
) -> InterpResult<'tcx, (Scalar<Tag>, bool)>;
2121

2222
fn ptr_eq(
2323
&self,
2424
left: Scalar<Tag>,
2525
right: Scalar<Tag>,
26-
) -> EvalResult<'tcx, bool>;
26+
) -> InterpResult<'tcx, bool>;
2727

2828
fn pointer_offset_inbounds(
2929
&self,
3030
ptr: Scalar<Tag>,
3131
pointee_ty: Ty<'tcx>,
3232
offset: i64,
33-
) -> EvalResult<'tcx, Scalar<Tag>>;
33+
) -> InterpResult<'tcx, Scalar<Tag>>;
3434
}
3535

3636
impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, 'tcx> {
@@ -39,7 +39,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
3939
bin_op: mir::BinOp,
4040
left: ImmTy<'tcx, Tag>,
4141
right: ImmTy<'tcx, Tag>,
42-
) -> EvalResult<'tcx, (Scalar<Tag>, bool)> {
42+
) -> InterpResult<'tcx, (Scalar<Tag>, bool)> {
4343
use rustc::mir::BinOp::*;
4444

4545
trace!("ptr_op: {:?} {:?} {:?}", *left, bin_op, *right);
@@ -138,7 +138,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
138138
&self,
139139
left: Scalar<Tag>,
140140
right: Scalar<Tag>,
141-
) -> EvalResult<'tcx, bool> {
141+
) -> InterpResult<'tcx, bool> {
142142
let size = self.pointer_size();
143143
Ok(match (left, right) {
144144
(Scalar::Raw { .. }, Scalar::Raw { .. }) =>
@@ -236,7 +236,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
236236
left: Pointer<Tag>,
237237
right: u128,
238238
signed: bool,
239-
) -> EvalResult<'tcx, (Scalar<Tag>, bool)> {
239+
) -> InterpResult<'tcx, (Scalar<Tag>, bool)> {
240240
use rustc::mir::BinOp::*;
241241

242242
fn map_to_primval((res, over): (Pointer<Tag>, bool)) -> (Scalar<Tag>, bool) {
@@ -328,7 +328,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'a, 'mir, '
328328
ptr: Scalar<Tag>,
329329
pointee_ty: Ty<'tcx>,
330330
offset: i64,
331-
) -> EvalResult<'tcx, Scalar<Tag>> {
331+
) -> InterpResult<'tcx, Scalar<Tag>> {
332332
// FIXME: assuming here that type size is less than `i64::max_value()`.
333333
let pointee_size = self.layout_of(pointee_ty)?.size.bytes() as i64;
334334
let offset = offset

0 commit comments

Comments
 (0)