diff options
| author | Ralf Jung <post@ralfj.de> | 2020-03-30 22:17:59 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-03-30 22:17:59 +0200 |
| commit | abe143abf19c676469ad1b6b9204a251ed5feada (patch) | |
| tree | e9ab029591c38fb97c78edcb3d38fe7ff0e63092 | |
| parent | 39e189d3bddf370d76e78aa3d912f393fc8b97b7 (diff) | |
| download | rust-abe143abf19c676469ad1b6b9204a251ed5feada.tar.gz rust-abe143abf19c676469ad1b6b9204a251ed5feada.zip | |
remove caller span from Miri stack frame
| -rw-r--r-- | src/librustc_mir/const_eval/eval_queries.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/eval_context.rs | 9 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/intrinsics/caller_location.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/terminator.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/transform/const_prop.rs | 1 |
5 files changed, 2 insertions, 12 deletions
diff --git a/src/librustc_mir/const_eval/eval_queries.rs b/src/librustc_mir/const_eval/eval_queries.rs index c30d41e6a92..af79198ef64 100644 --- a/src/librustc_mir/const_eval/eval_queries.rs +++ b/src/librustc_mir/const_eval/eval_queries.rs @@ -46,7 +46,6 @@ fn eval_body_using_ecx<'mir, 'tcx>( ecx.push_stack_frame( cid.instance, - body.span, body, Some(ret.into()), StackPopCleanup::None { cleanup: false }, diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs index 9680130bbde..cf80e55ae45 100644 --- a/src/librustc_mir/interpret/eval_context.rs +++ b/src/librustc_mir/interpret/eval_context.rs @@ -17,7 +17,7 @@ use rustc_middle::ty::layout::{self, Align, HasDataLayout, LayoutOf, Size, TyAnd use rustc_middle::ty::query::TyCtxtAt; use rustc_middle::ty::subst::SubstsRef; use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable}; -use rustc_span::source_map::{self, Span, DUMMY_SP}; +use rustc_span::source_map::{Span, DUMMY_SP}; use super::{ Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, OpTy, Operand, Place, PlaceTy, @@ -57,9 +57,6 @@ pub struct Frame<'mir, 'tcx, Tag = (), Extra = ()> { /// The def_id and substs of the current function. pub instance: ty::Instance<'tcx>, - /// The span of the call site. - pub span: source_map::Span, - /// Extra data for the machine. pub extra: Extra, @@ -502,7 +499,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { pub fn push_stack_frame( &mut self, instance: ty::Instance<'tcx>, - span: Span, body: &'mir mir::Body<'tcx>, return_place: Option<PlaceTy<'tcx, M::PointerTag>>, return_to_block: StackPopCleanup, @@ -522,7 +518,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // empty local array, we fill it in below, after we are inside the stack frame and // all methods actually know about the frame locals: IndexVec::new(), - span, instance, stmt: 0, extra, @@ -541,7 +536,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // statics and constants don't have `Storage*` statements, no need to look for them Some(DefKind::Static) | Some(DefKind::Const) | Some(DefKind::AssocConst) => {} _ => { - trace!("push_stack_frame: {:?}: num_bbs: {}", span, body.basic_blocks().len()); for block in body.basic_blocks() { for stmt in block.statements.iter() { use rustc_middle::mir::StatementKind::{StorageDead, StorageLive}; @@ -887,7 +881,6 @@ where fn hash_stable(&self, hcx: &mut StableHashingContext<'ctx>, hasher: &mut StableHasher) { self.body.hash_stable(hcx, hasher); self.instance.hash_stable(hcx, hasher); - self.span.hash_stable(hcx, hasher); self.return_to_block.hash_stable(hcx, hasher); self.return_place.as_ref().map(|r| &**r).hash_stable(hcx, hasher); self.locals.hash_stable(hcx, hasher); diff --git a/src/librustc_mir/interpret/intrinsics/caller_location.rs b/src/librustc_mir/interpret/intrinsics/caller_location.rs index 37b01d6db3b..bbc866e0177 100644 --- a/src/librustc_mir/interpret/intrinsics/caller_location.rs +++ b/src/librustc_mir/interpret/intrinsics/caller_location.rs @@ -17,10 +17,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { crate fn find_closest_untracked_caller_location(&self) -> Option<Span> { let mut caller_span = None; for next_caller in self.stack.iter().rev() { + caller_span = next_caller.current_source_info().map(|si| si.span).or_else(|| caller_span); if !next_caller.instance.def.requires_caller_location(*self.tcx) { return caller_span; } - caller_span = Some(next_caller.span); } caller_span diff --git a/src/librustc_mir/interpret/terminator.rs b/src/librustc_mir/interpret/terminator.rs index a490a0f9bcc..8eedd606145 100644 --- a/src/librustc_mir/interpret/terminator.rs +++ b/src/librustc_mir/interpret/terminator.rs @@ -259,7 +259,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { self.push_stack_frame( instance, - span, body, ret.map(|p| p.0), StackPopCleanup::Goto { ret: ret.map(|p| p.1), unwind }, diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 8e004e45b7a..c45942c4933 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -364,7 +364,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { ecx.push_stack_frame( Instance::new(def_id, substs), - span, dummy_body, ret.map(Into::into), StackPopCleanup::None { cleanup: false }, |
