Skip to content

Commit

Permalink
adjust for span not being passed around any more
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Mar 30, 2020
1 parent aa2645a commit 627dd94
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 17 deletions.
9 changes: 1 addition & 8 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use rustc_middle::ty::{
List, TyCtxt,
};
use rustc_hir::def_id::{DefId, CRATE_DEF_INDEX};
use rustc_span::source_map::DUMMY_SP;

use rand::RngCore;

Expand Down Expand Up @@ -157,13 +156,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx

// Push frame.
let mir = &*this.load_mir(f.def, None)?;
let span = this
.stack()
.last()
.and_then(Frame::current_source_info)
.map(|si| si.span)
.unwrap_or(DUMMY_SP);
this.push_stack_frame(f, span, mir, dest, stack_pop)?;
this.push_stack_frame(f, mir, dest, stack_pop)?;

// Initialize arguments.
let mut callee_args = this.frame().body.args_iter();
Expand Down
6 changes: 2 additions & 4 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use rustc_middle::ty::{
Ty,
};
use rustc_ast::attr;
use rustc_span::{source_map::Span, symbol::{sym, Symbol}};
use rustc_span::symbol::{sym, Symbol};

use crate::*;

Expand Down Expand Up @@ -253,7 +253,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
#[inline(always)]
fn find_mir_or_eval_fn(
ecx: &mut InterpCx<'mir, 'tcx, Self>,
_span: Span,
instance: ty::Instance<'tcx>,
args: &[OpTy<'tcx, Tag>],
ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
Expand All @@ -276,13 +275,12 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
#[inline(always)]
fn call_intrinsic(
ecx: &mut rustc_mir::interpret::InterpCx<'mir, 'tcx, Self>,
span: Span,
instance: ty::Instance<'tcx>,
args: &[OpTy<'tcx, Tag>],
ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
unwind: Option<mir::BasicBlock>,
) -> InterpResult<'tcx> {
ecx.call_intrinsic(span, instance, args, ret, unwind)
ecx.call_intrinsic(instance, args, ret, unwind)
}

#[inline(always)]
Expand Down
4 changes: 1 addition & 3 deletions src/shims/intrinsics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,20 @@ use rustc_middle::mir;
use rustc_middle::ty;
use rustc_middle::ty::layout::{Align, LayoutOf};
use rustc_apfloat::Float;
use rustc_span::source_map::Span;

use crate::*;

impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
fn call_intrinsic(
&mut self,
span: Span,
instance: ty::Instance<'tcx>,
args: &[OpTy<'tcx, Tag>],
ret: Option<(PlaceTy<'tcx, Tag>, mir::BasicBlock)>,
unwind: Option<mir::BasicBlock>,
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();
if this.emulate_intrinsic(span, instance, args, ret)? {
if this.emulate_intrinsic(instance, args, ret)? {
return Ok(());
}
let substs = instance.substs;
Expand Down
4 changes: 2 additions & 2 deletions src/shims/panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
) -> InterpResult<'tcx> {
let this = self.eval_context_mut();

trace!("miri_start_panic: {:?}", this.frame().span);
trace!("miri_start_panic: {:?}", this.frame().instance);

// Get the raw pointer stored in arg[0] (the panic payload).
let payload = this.read_scalar(args[0])?.not_undef()?;
Expand Down Expand Up @@ -133,7 +133,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
if let (true, Some(catch_unwind)) = (unwinding, extra.catch_unwind.take()) {
// We've just popped a frame that was pushed by `try`,
// and we are unwinding, so we should catch that.
trace!("unwinding: found catch_panic frame during unwinding: {:?}", this.frame().span);
trace!("unwinding: found catch_panic frame during unwinding: {:?}", this.frame().instance);

// We set the return value of `try` to 1, since there was a panic.
this.write_scalar(Scalar::from_i32(1), catch_unwind.dest)?;
Expand Down

0 comments on commit 627dd94

Please sign in to comment.