Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit abe143a

Browse files
committed
remove caller span from Miri stack frame
1 parent 39e189d commit abe143a

File tree

5 files changed

+2
-12
lines changed

5 files changed

+2
-12
lines changed

src/librustc_mir/const_eval/eval_queries.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ fn eval_body_using_ecx<'mir, 'tcx>(
4646

4747
ecx.push_stack_frame(
4848
cid.instance,
49-
body.span,
5049
body,
5150
Some(ret.into()),
5251
StackPopCleanup::None { cleanup: false },

src/librustc_mir/interpret/eval_context.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::ty::layout::{self, Align, HasDataLayout, LayoutOf, Size, TyAnd
1717
use rustc_middle::ty::query::TyCtxtAt;
1818
use rustc_middle::ty::subst::SubstsRef;
1919
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable};
20-
use rustc_span::source_map::{self, Span, DUMMY_SP};
20+
use rustc_span::source_map::{Span, DUMMY_SP};
2121

2222
use super::{
2323
Immediate, MPlaceTy, Machine, MemPlace, MemPlaceMeta, Memory, OpTy, Operand, Place, PlaceTy,
@@ -57,9 +57,6 @@ pub struct Frame<'mir, 'tcx, Tag = (), Extra = ()> {
5757
/// The def_id and substs of the current function.
5858
pub instance: ty::Instance<'tcx>,
5959

60-
/// The span of the call site.
61-
pub span: source_map::Span,
62-
6360
/// Extra data for the machine.
6461
pub extra: Extra,
6562

@@ -502,7 +499,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
502499
pub fn push_stack_frame(
503500
&mut self,
504501
instance: ty::Instance<'tcx>,
505-
span: Span,
506502
body: &'mir mir::Body<'tcx>,
507503
return_place: Option<PlaceTy<'tcx, M::PointerTag>>,
508504
return_to_block: StackPopCleanup,
@@ -522,7 +518,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
522518
// empty local array, we fill it in below, after we are inside the stack frame and
523519
// all methods actually know about the frame
524520
locals: IndexVec::new(),
525-
span,
526521
instance,
527522
stmt: 0,
528523
extra,
@@ -541,7 +536,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
541536
// statics and constants don't have `Storage*` statements, no need to look for them
542537
Some(DefKind::Static) | Some(DefKind::Const) | Some(DefKind::AssocConst) => {}
543538
_ => {
544-
trace!("push_stack_frame: {:?}: num_bbs: {}", span, body.basic_blocks().len());
545539
for block in body.basic_blocks() {
546540
for stmt in block.statements.iter() {
547541
use rustc_middle::mir::StatementKind::{StorageDead, StorageLive};
@@ -887,7 +881,6 @@ where
887881
fn hash_stable(&self, hcx: &mut StableHashingContext<'ctx>, hasher: &mut StableHasher) {
888882
self.body.hash_stable(hcx, hasher);
889883
self.instance.hash_stable(hcx, hasher);
890-
self.span.hash_stable(hcx, hasher);
891884
self.return_to_block.hash_stable(hcx, hasher);
892885
self.return_place.as_ref().map(|r| &**r).hash_stable(hcx, hasher);
893886
self.locals.hash_stable(hcx, hasher);

src/librustc_mir/interpret/intrinsics/caller_location.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
1717
crate fn find_closest_untracked_caller_location(&self) -> Option<Span> {
1818
let mut caller_span = None;
1919
for next_caller in self.stack.iter().rev() {
20+
caller_span = next_caller.current_source_info().map(|si| si.span).or_else(|| caller_span);
2021
if !next_caller.instance.def.requires_caller_location(*self.tcx) {
2122
return caller_span;
2223
}
23-
caller_span = Some(next_caller.span);
2424
}
2525

2626
caller_span

src/librustc_mir/interpret/terminator.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
259259

260260
self.push_stack_frame(
261261
instance,
262-
span,
263262
body,
264263
ret.map(|p| p.0),
265264
StackPopCleanup::Goto { ret: ret.map(|p| p.1), unwind },

src/librustc_mir/transform/const_prop.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,6 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> {
364364

365365
ecx.push_stack_frame(
366366
Instance::new(def_id, substs),
367-
span,
368367
dummy_body,
369368
ret.map(Into::into),
370369
StackPopCleanup::None { cleanup: false },

0 commit comments

Comments
 (0)