1
Fork 0

rename FrameInfo span field to call_site

This commit is contained in:
Ralf Jung 2018-11-15 08:59:49 +01:00
parent b396505425
commit 62cf9abcf6
3 changed files with 6 additions and 6 deletions

View file

@ -388,7 +388,7 @@ impl_stable_hash_for!(enum mir::interpret::ErrorHandled {
}); });
impl_stable_hash_for!(struct mir::interpret::FrameInfo<'tcx> { impl_stable_hash_for!(struct mir::interpret::FrameInfo<'tcx> {
span, call_site,
lint_root, lint_root,
instance instance
}); });

View file

@ -57,7 +57,7 @@ pub struct ConstEvalErr<'tcx> {
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)] #[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
pub struct FrameInfo<'tcx> { pub struct FrameInfo<'tcx> {
pub span: Span, pub call_site: Span, // this span is in the caller!
pub instance: ty::Instance<'tcx>, pub instance: ty::Instance<'tcx>,
pub lint_root: Option<ast::NodeId>, pub lint_root: Option<ast::NodeId>,
} }
@ -72,8 +72,8 @@ impl<'tcx> fmt::Display for FrameInfo<'tcx> {
} else { } else {
write!(f, "inside call to `{}`", self.instance)?; write!(f, "inside call to `{}`", self.instance)?;
} }
if !self.span.is_dummy() { if !self.call_site.is_dummy() {
let lo = tcx.sess.source_map().lookup_char_pos_adj(self.span.lo()); let lo = tcx.sess.source_map().lookup_char_pos_adj(self.call_site.lo());
write!(f, " at {}:{}:{}", lo.filename, lo.line, lo.col.to_usize() + 1)?; write!(f, " at {}:{}:{}", lo.filename, lo.line, lo.col.to_usize() + 1)?;
} }
Ok(()) Ok(())
@ -159,7 +159,7 @@ impl<'a, 'gcx, 'tcx> ConstEvalErr<'tcx> {
// on constant values. // on constant values.
if self.stacktrace.len() > 0 { if self.stacktrace.len() > 0 {
for frame_info in &self.stacktrace[..self.stacktrace.len()-1] { for frame_info in &self.stacktrace[..self.stacktrace.len()-1] {
err.span_label(frame_info.span, frame_info.to_string()); err.span_label(frame_info.call_site, frame_info.to_string());
} }
} }
Ok(err) Ok(err)

View file

@ -679,7 +679,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'a, 'mir, 'tcx>> EvalContext<'a, 'mir, 'tc
mir::ClearCrossCrate::Set(ref ivs) => Some(ivs[source_info.scope].lint_root), mir::ClearCrossCrate::Set(ref ivs) => Some(ivs[source_info.scope].lint_root),
mir::ClearCrossCrate::Clear => None, mir::ClearCrossCrate::Clear => None,
}; };
frames.push(FrameInfo { span, instance, lint_root }); frames.push(FrameInfo { call_site: span, instance, lint_root });
} }
trace!("generate stacktrace: {:#?}, {:?}", frames, explicit_span); trace!("generate stacktrace: {:#?}, {:?}", frames, explicit_span);
frames frames