|
| 1 | +From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Josh Stone < [email protected]> |
| 3 | +Date: Mon, 8 Apr 2024 15:04:44 -0700 |
| 4 | +Subject: [PATCH] Fix UI tests with dist-vendored dependencies |
| 5 | + |
| 6 | +There is already a workaround in `compiletest` to deal with custom |
| 7 | +`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`. |
| 8 | +A similar need exists when dependencies come from the local `vendor` |
| 9 | +directory, which distro builds often use, so now we ignore that too. |
| 10 | + |
| 11 | +Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably |
| 12 | +expecting a version suffix, but the vendored path doesn't include the |
| 13 | +version. Now that matches `[\\/]hashbrown` instead. |
| 14 | +--- |
| 15 | + src/tools/compiletest/src/runtest.rs | 5 +++++ |
| 16 | + tests/ui/issues/issue-21763.rs | 2 +- |
| 17 | + 2 files changed, 6 insertions(+), 1 deletion(-) |
| 18 | + |
| 19 | +diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs |
| 20 | +index bb8509fe41377..770496289e2e7 100644 |
| 21 | +--- a/src/tools/compiletest/src/runtest.rs |
| 22 | ++++ b/src/tools/compiletest/src/runtest.rs |
| 23 | +@@ -2354,6 +2354,11 @@ impl<'test> TestCx<'test> { |
| 24 | + "ignore-directory-in-diagnostics-source-blocks={}", |
| 25 | + home::cargo_home().expect("failed to find cargo home").to_str().unwrap() |
| 26 | + )); |
| 27 | ++ // Similarly, vendored sources shouldn't be shown when running from a dist tarball. |
| 28 | ++ rustc.arg("-Z").arg(format!( |
| 29 | ++ "ignore-directory-in-diagnostics-source-blocks={}", |
| 30 | ++ self.config.find_rust_src_root().unwrap().join("vendor").display(), |
| 31 | ++ )); |
| 32 | + |
| 33 | + // Optionally prevent default --sysroot if specified in test compile-flags. |
| 34 | + if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) |
| 35 | +diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs |
| 36 | +index a349253063c02..1d0a0705cbbd9 100644 |
| 37 | +--- a/tests/ui/issues/issue-21763.rs |
| 38 | ++++ b/tests/ui/issues/issue-21763.rs |
| 39 | +@@ -1,6 +1,6 @@ |
| 40 | + // Regression test for HashMap only impl'ing Send/Sync if its contents do |
| 41 | + |
| 42 | +-// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" |
| 43 | ++// normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" |
| 44 | + |
| 45 | + use std::collections::HashMap; |
| 46 | + use std::rc::Rc; |
0 commit comments