Skip to content

Commit ea96099

Browse files
committed
dont use escape with Ty debug formatting
1 parent 2440e80 commit ea96099

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

compiler/rustc_middle/src/mir/graphviz.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ use rustc_graphviz as dot;
33
use rustc_hir::def_id::DefId;
44
use rustc_middle::mir::*;
55
use rustc_middle::ty::{self, TyCtxt};
6-
use std::fmt::Debug;
76
use std::io::{self, Write};
87

98
use super::generic_graph::mir_fn_to_generic_graph;
@@ -103,7 +102,7 @@ fn write_graph_label<'tcx, W: std::fmt::Write>(
103102
write!(w, "{:?}: {}", Place::from(arg), escape(&body.local_decls[arg].ty))?;
104103
}
105104

106-
write!(w, ") -&gt; {}", dot::escape_html(&format!("{}", body.return_ty())))?;
105+
write!(w, ") -&gt; {}", escape(&body.return_ty()))?;
107106
write!(w, r#"<br align="left"/>"#)?;
108107

109108
for local in body.vars_and_temps_iter() {
@@ -122,13 +121,13 @@ fn write_graph_label<'tcx, W: std::fmt::Write>(
122121
w,
123122
r#"debug {} =&gt; {};<br align="left"/>"#,
124123
var_debug_info.name,
125-
escape(&var_debug_info.value),
124+
dot::escape_html(&format!("{:?}", &var_debug_info.value)),
126125
)?;
127126
}
128127

129128
Ok(())
130129
}
131130

132-
fn escape<T: Debug>(t: &T) -> String {
133-
dot::escape_html(&format!("{:?}", t))
131+
fn escape<T: Display>(t: &T) -> String {
132+
dot::escape_html(&format!("{}", t))
134133
}

0 commit comments

Comments
 (0)