Skip to content

Commit 849c565

Browse files
committed
Prevent local paths into libstd from leaking into ui tests
1 parent 5a7fc9b commit 849c565

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/test/ui/impl-trait/impl-generic-mismatch.stderr

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

src/tools/compiletest/src/runtest.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2861,6 +2861,15 @@ impl<'test> TestCx<'test> {
28612861

28622862
let mut normalized = output.replace(&parent_dir_str, "$DIR");
28632863

2864+
// Paths into the libstd/libcore
2865+
let src_dir = self.config.src_base.parent().unwrap().parent().unwrap();
2866+
let src_dir_str = if json {
2867+
src_dir.display().to_string().replace("\\", "\\\\")
2868+
} else {
2869+
src_dir.display().to_string()
2870+
};
2871+
normalized = normalized.replace(&src_dir_str, "$SRC_DIR");
2872+
28642873
if json {
28652874
// escaped newlines in json strings should be readable
28662875
// in the stderr files. There's no point int being correct,

0 commit comments

Comments
 (0)