Skip to content

Commit e326e86

Browse files
committed
Auto merge of #41588 - cengizIO:master, r=nikomatsakis
use diff crate for compile-fail test diagnostics #41474 Hello! This fixes #41474 We were using a custom implementation to dump the differences between expected and actual outputs of compile-fail tests. I removed this internal implementation and added `diff` crate as a new dependency to `compile-fail`. Again, huge thanks to @nikomatsakis for guiding.
2 parents 12e76e2 + 837817c commit e326e86

File tree

5 files changed

+17
-77
lines changed

5 files changed

+17
-77
lines changed

src/Cargo.lock

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/tools/compiletest/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ log = "0.3"
88
env_logger = { version = "0.4", default-features = false }
99
rustc-serialize = "0.3"
1010
filetime = "0.1"
11+
diff = "0.1.10"

src/tools/compiletest/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ extern crate rustc_serialize;
2525
extern crate log;
2626
extern crate env_logger;
2727
extern crate filetime;
28+
extern crate diff;
2829

2930
use std::env;
3031
use std::ffi::OsString;
@@ -49,7 +50,6 @@ pub mod runtest;
4950
pub mod common;
5051
pub mod errors;
5152
mod raise_fd_limit;
52-
mod uidiff;
5353

5454
fn main() {
5555
env_logger::init().unwrap();

src/tools/compiletest/src/runtest.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ use common::Config;
1212
use common::{CompileFail, ParseFail, Pretty, RunFail, RunPass, RunPassValgrind};
1313
use common::{Codegen, DebugInfoLldb, DebugInfoGdb, Rustdoc, CodegenUnits};
1414
use common::{Incremental, RunMake, Ui, MirOpt};
15+
use diff;
1516
use errors::{self, ErrorKind, Error};
1617
use filetime::FileTime;
1718
use json;
1819
use header::TestProps;
1920
use procsrv;
2021
use test::TestPaths;
21-
use uidiff;
2222
use util::logv;
2323

2424
use std::collections::HashSet;
@@ -2411,8 +2411,13 @@ actual:\n\
24112411
println!("normalized {}:\n{}\n", kind, actual);
24122412
println!("expected {}:\n{}\n", kind, expected);
24132413
println!("diff of {}:\n", kind);
2414-
for line in uidiff::diff_lines(actual, expected) {
2415-
println!("{}", line);
2414+
2415+
for diff in diff::lines(actual, expected) {
2416+
match diff {
2417+
diff::Result::Left(l) => println!("+{}", l),
2418+
diff::Result::Both(l, _) => println!(" {}", l),
2419+
diff::Result::Right(r) => println!("-{}", r),
2420+
}
24162421
}
24172422

24182423
let output_file = self.output_base_name().with_extension(kind);

src/tools/compiletest/src/uidiff.rs

-73
This file was deleted.

0 commit comments

Comments
 (0)