Prevent local paths into libstd from leaking into ui tests

This commit is contained in:
Oliver Schneider 2018-05-22 12:00:27 +02:00
parent 5a7fc9b33a
commit 849c565e2f
2 changed files with 10 additions and 1 deletions

View File

@ -34,7 +34,7 @@ error[E0643]: method `hash` has incompatible signature for trait
LL | fn hash(&self, hasher: &mut impl Hasher) {}
| ^^^^^^^^^^^ expected generic parameter, found `impl Trait`
|
::: /home/oliver/Projects/rust/rust3/src/libcore/hash/mod.rs:185:13
::: $SRC_DIR/libcore/hash/mod.rs:185:13
|
LL | fn hash<H: Hasher>(&self, state: &mut H);
| - declaration in trait here

View File

@ -2861,6 +2861,15 @@ impl<'test> TestCx<'test> {
let mut normalized = output.replace(&parent_dir_str, "$DIR");
// Paths into the libstd/libcore
let src_dir = self.config.src_base.parent().unwrap().parent().unwrap();
let src_dir_str = if json {
src_dir.display().to_string().replace("\\", "\\\\")
} else {
src_dir.display().to_string()
};
normalized = normalized.replace(&src_dir_str, "$SRC_DIR");
if json {
// escaped newlines in json strings should be readable
// in the stderr files. There's no point int being correct,