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 @@ fn hash_stable<W: StableHasherResult>(
});
impl_stable_hash_for!(struct mir::interpret::FrameInfo<'tcx> {
span,
call_site,
lint_root,
instance
});

View File

@ -57,7 +57,7 @@ pub struct ConstEvalErr<'tcx> {
#[derive(Clone, Debug, RustcEncodable, RustcDecodable)]
pub struct FrameInfo<'tcx> {
pub span: Span,
pub call_site: Span, // this span is in the caller!
pub instance: ty::Instance<'tcx>,
pub lint_root: Option<ast::NodeId>,
}
@ -72,8 +72,8 @@ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
} else {
write!(f, "inside call to `{}`", self.instance)?;
}
if !self.span.is_dummy() {
let lo = tcx.sess.source_map().lookup_char_pos_adj(self.span.lo());
if !self.call_site.is_dummy() {
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)?;
}
Ok(())
@ -159,7 +159,7 @@ fn struct_generic(
// on constant values.
if self.stacktrace.len() > 0 {
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)

View File

@ -679,7 +679,7 @@ pub fn generate_stacktrace(&self, explicit_span: Option<Span>) -> Vec<FrameInfo<
mir::ClearCrossCrate::Set(ref ivs) => Some(ivs[source_info.scope].lint_root),
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);
frames