Move generate_stacktrace_from_stack away from InterpCx to avoid having to know the Machine
type
This commit is contained in:
parent
6b936b6c08
commit
d2d2bd2736
4 changed files with 32 additions and 37 deletions
|
@ -8,9 +8,9 @@ use rustc_middle::ty::TyCtxt;
|
|||
use rustc_middle::ty::{layout::LayoutError, ConstInt};
|
||||
use rustc_span::{Span, Symbol, DUMMY_SP};
|
||||
|
||||
use super::{CompileTimeInterpreter, InterpCx};
|
||||
use super::CompileTimeInterpreter;
|
||||
use crate::errors::{self, FrameNote, ReportErrorExt};
|
||||
use crate::interpret::{ErrorHandled, InterpError, InterpErrorInfo, MachineStopType};
|
||||
use crate::interpret::{ErrorHandled, Frame, InterpError, InterpErrorInfo, MachineStopType};
|
||||
|
||||
/// The CTFE machine has some custom error kinds.
|
||||
#[derive(Clone, Debug)]
|
||||
|
@ -63,10 +63,7 @@ pub fn get_span_and_frames<'tcx, 'mir>(
|
|||
where
|
||||
'tcx: 'mir,
|
||||
{
|
||||
let mut stacktrace =
|
||||
InterpCx::<CompileTimeInterpreter<'mir, 'tcx>>::generate_stacktrace_from_stack(
|
||||
&machine.stack,
|
||||
);
|
||||
let mut stacktrace = Frame::generate_stacktrace_from_stack(&machine.stack);
|
||||
// Filter out `requires_caller_location` frames.
|
||||
stacktrace.retain(|frame| !frame.instance.def.requires_caller_location(*tcx));
|
||||
let span = stacktrace.first().map(|f| f.span).unwrap_or(tcx.span);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue