Skip to content

Commit 393cd89

Browse files
authored
Rollup merge of rust-lang#47978 - eddyb:iu, r=kennytm
ui tests: diff from old (expected) to new (actual) instead of backwards. Previously `actual` was "old" and `expected` was "new" which resulted in `+` before `-`. AFAIK all diff tools put `-` before `+`, which made the previous behavior *very confusing*. r? @nikomatsakis
2 parents e58cff2 + cc68afb commit 393cd89

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/tools/compiletest/src/runtest.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
7979
let mut results = Vec::new();
8080
let mut mismatch = Mismatch::new(0);
8181

82-
for result in diff::lines(actual, expected) {
82+
for result in diff::lines(expected, actual) {
8383
match result {
8484
diff::Result::Left(str) => {
8585
if lines_since_mismatch >= context_size && lines_since_mismatch > 0 {
@@ -91,7 +91,8 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
9191
mismatch.lines.push(DiffLine::Context(line.to_owned()));
9292
}
9393

94-
mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
94+
mismatch.lines.push(DiffLine::Expected(str.to_owned()));
95+
line_number += 1;
9596
lines_since_mismatch = 0;
9697
}
9798
diff::Result::Right(str) => {
@@ -104,8 +105,7 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec<Misma
104105
mismatch.lines.push(DiffLine::Context(line.to_owned()));
105106
}
106107

107-
mismatch.lines.push(DiffLine::Expected(str.to_owned()));
108-
line_number += 1;
108+
mismatch.lines.push(DiffLine::Resulting(str.to_owned()));
109109
lines_since_mismatch = 0;
110110
}
111111
diff::Result::Both(str, _) => {

0 commit comments

Comments
 (0)