about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorCamille GILLOT <gillot.camille@gmail.com>2023-09-09 16:41:57 +0000
committerCamille GILLOT <gillot.camille@gmail.com>2023-09-11 16:29:42 +0000
commitbcfe1a4bf2347e2f8df209f72930b335d5edddcf (patch)
treec67c0d626c1d13ead96c05c6a35bcd86697ea88b /compiler/rustc_const_eval/src
parent24adf07e5f7a6097088787c3658a1b98b772df5d (diff)
downloadrust-bcfe1a4bf2347e2f8df209f72930b335d5edddcf.tar.gz
rust-bcfe1a4bf2347e2f8df209f72930b335d5edddcf.zip
Remove cur_span hook.
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/interpret/eval_context.rs4
-rw-r--r--compiler/rustc_const_eval/src/interpret/machine.rs11
2 files changed, 3 insertions, 12 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs
index 3bbafada8f6..db1eaf58621 100644
--- a/compiler/rustc_const_eval/src/interpret/eval_context.rs
+++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs
@@ -445,7 +445,9 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
 
     #[inline(always)]
     pub fn cur_span(&self) -> Span {
-        M::cur_span(self)
+        // This deliberately does *not* honor `requires_caller_location` since it is used for much
+        // more than just panics.
+        self.stack().last().map_or(self.tcx.span, |f| f.current_span())
     }
 
     #[inline(always)]
diff --git a/compiler/rustc_const_eval/src/interpret/machine.rs b/compiler/rustc_const_eval/src/interpret/machine.rs
index 0fe99085d67..9fda6b037c8 100644
--- a/compiler/rustc_const_eval/src/interpret/machine.rs
+++ b/compiler/rustc_const_eval/src/interpret/machine.rs
@@ -11,7 +11,6 @@ use rustc_middle::mir;
 use rustc_middle::ty::layout::TyAndLayout;
 use rustc_middle::ty::{self, Ty, TyCtxt};
 use rustc_span::def_id::DefId;
-use rustc_span::Span;
 use rustc_target::abi::{Align, Size};
 use rustc_target::spec::abi::Abi as CallAbi;
 
@@ -441,16 +440,6 @@ pub trait Machine<'mir, 'tcx: 'mir>: Sized {
         frame: Frame<'mir, 'tcx, Self::Provenance>,
     ) -> InterpResult<'tcx, Frame<'mir, 'tcx, Self::Provenance, Self::FrameExtra>>;
 
-    #[inline(always)]
-    fn cur_span(ecx: &InterpCx<'mir, 'tcx, Self>) -> Span
-    where
-        'tcx: 'mir,
-    {
-        // This deliberately does *not* honor `requires_caller_location` since it is used for much
-        // more than just panics.
-        Self::stack(ecx).last().map_or(ecx.tcx.span, |f| f.current_span())
-    }
-
     /// Borrow the current thread's stack.
     fn stack<'a>(
         ecx: &'a InterpCx<'mir, 'tcx, Self>,