mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Move users of span_to_embeddable_string to span_to_diagnostic_string
This is done in order to simplify the filename overhaul and those places don't need to the embeddable path anyway.
This commit is contained in:
@@ -80,7 +80,7 @@ fn for_each_constraint(
|
||||
let OutlivesConstraint { sup, sub, locations, category, span, .. } = constraint;
|
||||
let (name, arg) = match locations {
|
||||
Locations::All(span) => {
|
||||
("All", tcx.sess.source_map().span_to_embeddable_string(*span))
|
||||
("All", tcx.sess.source_map().span_to_diagnostic_string(*span))
|
||||
}
|
||||
Locations::Single(loc) => ("Single", format!("{loc:?}")),
|
||||
};
|
||||
|
||||
@@ -138,10 +138,7 @@ pub(crate) fn update_macro_stats(
|
||||
if false {
|
||||
let name = ExpnKind::Macro(macro_kind, name).descr();
|
||||
let crate_name = &ecx.ecfg.crate_name;
|
||||
let span = ecx
|
||||
.sess
|
||||
.source_map()
|
||||
.span_to_string(span, rustc_span::FileNameDisplayPreference::Local);
|
||||
let span = ecx.sess.source_map().span_to_diagnostic_string(span);
|
||||
eprint!(
|
||||
"\
|
||||
-------------------------------\n\
|
||||
|
||||
@@ -504,7 +504,7 @@ fn write_scope_tree(
|
||||
"{0:1$} // at {2}",
|
||||
indented_header,
|
||||
ALIGN,
|
||||
tcx.sess.source_map().span_to_embeddable_string(span),
|
||||
tcx.sess.source_map().span_to_diagnostic_string(span),
|
||||
)?;
|
||||
} else {
|
||||
writeln!(w, "{indented_header}")?;
|
||||
@@ -688,7 +688,7 @@ fn write_user_type_annotations(
|
||||
"| {:?}: user_ty: {}, span: {}, inferred_ty: {}",
|
||||
index.index(),
|
||||
annotation.user_ty,
|
||||
tcx.sess.source_map().span_to_embeddable_string(annotation.span),
|
||||
tcx.sess.source_map().span_to_diagnostic_string(annotation.span),
|
||||
with_no_trimmed_paths!(format!("{}", annotation.inferred_ty)),
|
||||
)?;
|
||||
}
|
||||
@@ -1420,7 +1420,7 @@ fn visit_const_operand(&mut self, constant: &ConstOperand<'tcx>, _location: Loca
|
||||
self.push("mir::ConstOperand");
|
||||
self.push(&format!(
|
||||
"+ span: {}",
|
||||
self.tcx.sess.source_map().span_to_embeddable_string(*span)
|
||||
self.tcx.sess.source_map().span_to_diagnostic_string(*span)
|
||||
));
|
||||
if let Some(user_ty) = user_ty {
|
||||
self.push(&format!("+ user_ty: {user_ty:?}"));
|
||||
@@ -1503,7 +1503,7 @@ fn visit_rvalue(&mut self, rvalue: &Rvalue<'tcx>, location: Location) {
|
||||
}
|
||||
|
||||
fn comment(tcx: TyCtxt<'_>, SourceInfo { span, scope }: SourceInfo) -> String {
|
||||
let location = tcx.sess.source_map().span_to_embeddable_string(span);
|
||||
let location = tcx.sess.source_map().span_to_diagnostic_string(span);
|
||||
format!("scope {} at {}", scope.index(), location,)
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ pub(crate) fn dump_closure_profile<'tcx>(tcx: TyCtxt<'tcx>, closure_instance: In
|
||||
.unwrap_or_else(|e| format!("Failed {e:?}"));
|
||||
|
||||
let closure_span = tcx.def_span(closure_def_id);
|
||||
let src_file = tcx.sess.source_map().span_to_filename(closure_span);
|
||||
let src_file = tcx.sess.source_map().span_to_diagnostic_string(closure_span);
|
||||
let line_nos = tcx
|
||||
.sess
|
||||
.source_map()
|
||||
@@ -57,14 +57,7 @@ pub(crate) fn dump_closure_profile<'tcx>(tcx: TyCtxt<'tcx>, closure_instance: In
|
||||
.map(|l| format!("{:?} {:?}", l.lines.first(), l.lines.last()))
|
||||
.unwrap_or_else(|e| format!("{e:?}"));
|
||||
|
||||
if let Err(e) = writeln!(
|
||||
file,
|
||||
"{}, {}, {}, {:?}",
|
||||
old_size,
|
||||
new_size,
|
||||
src_file.prefer_local(),
|
||||
line_nos
|
||||
) {
|
||||
if let Err(e) = writeln!(file, "{}, {}, {}, {:?}", old_size, new_size, src_file, line_nos) {
|
||||
eprintln!("Error writing to file {e}")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user