Skip to content

Commit cf32cab

Browse files
Rollup merge of rust-lang#152658 - scrabsha:normalize-before-svg, r=jieyouxu
compiletest: normalize stderr before SVG rendering Element position is hardcoded in the rendered SVG. This means that any change in element length (for instance, when substituting the path with the `rust` checkout with `$DIR`) would not change the position and result in buggy SVG being generated. Normalizing before SVG rendering allows us to keep a consistent element placement.
2 parents 78fac69 + c259c40 commit cf32cab

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

src/tools/compiletest/src/runtest.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2384,15 +2384,22 @@ impl<'test> TestCx<'test> {
23842384
_ => {}
23852385
};
23862386

2387-
let stderr = if self.force_color_svg() {
2388-
anstyle_svg::Term::new().render_svg(&proc_res.stderr)
2389-
} else if explicit_format {
2390-
proc_res.stderr.clone()
2387+
let stderr;
2388+
let normalized_stderr;
2389+
2390+
if self.force_color_svg() {
2391+
let normalized = self.normalize_output(&proc_res.stderr, &self.props.normalize_stderr);
2392+
stderr = anstyle_svg::Term::new().render_svg(&normalized);
2393+
normalized_stderr = stderr.clone();
23912394
} else {
2392-
json::extract_rendered(&proc_res.stderr)
2393-
};
2395+
stderr = if explicit_format {
2396+
proc_res.stderr.clone()
2397+
} else {
2398+
json::extract_rendered(&proc_res.stderr)
2399+
};
2400+
normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
2401+
}
23942402

2395-
let normalized_stderr = self.normalize_output(&stderr, &self.props.normalize_stderr);
23962403
let mut errors = 0;
23972404
match output_kind {
23982405
TestOutput::Compile => {

0 commit comments

Comments
 (0)