From a2e7c0bd071d5543ef43c67d27ad2b1c75755e29 Mon Sep 17 00:00:00 2001 From: Philippe Renon Date: Tue, 16 Apr 2024 14:22:31 +0200 Subject: [PATCH] rust: fix issue-21763.rs test failure when vendor is enabled the issue is fixed upstream in 1.79.0 see https://github.com/rust-lang/rust/pull/123652 that fix requires a prior and massive commit see https://github.com/cuviper/rust/commit/ec2cc761bc7067712ecc7734502f703fe3b024c8 so a tailored patch was made --- mingw-w64-rust/0014-fix-vendored-test.patch | 46 +++++++++++++++++++++ mingw-w64-rust/PKGBUILD | 11 ++++- 2 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 mingw-w64-rust/0014-fix-vendored-test.patch diff --git a/mingw-w64-rust/0014-fix-vendored-test.patch b/mingw-w64-rust/0014-fix-vendored-test.patch new file mode 100644 index 0000000000000..f9f7679b80620 --- /dev/null +++ b/mingw-w64-rust/0014-fix-vendored-test.patch @@ -0,0 +1,46 @@ +From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Mon, 8 Apr 2024 15:04:44 -0700 +Subject: [PATCH] Fix UI tests with dist-vendored dependencies + +There is already a workaround in `compiletest` to deal with custom +`CARGO_HOME` using `-Zignore-directory-in-diagnostics-source-blocks={}`. +A similar need exists when dependencies come from the local `vendor` +directory, which distro builds often use, so now we ignore that too. + +Also, `issue-21763.rs` was normalizing `hashbrown-` paths, presumably +expecting a version suffix, but the vendored path doesn't include the +version. Now that matches `[\\/]hashbrown` instead. +--- + src/tools/compiletest/src/runtest.rs | 5 +++++ + tests/ui/issues/issue-21763.rs | 2 +- + 2 files changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs +index bb8509fe41377..770496289e2e7 100644 +--- a/src/tools/compiletest/src/runtest.rs ++++ b/src/tools/compiletest/src/runtest.rs +@@ -2354,6 +2354,11 @@ impl<'test> TestCx<'test> { + "ignore-directory-in-diagnostics-source-blocks={}", + home::cargo_home().expect("failed to find cargo home").to_str().unwrap() + )); ++ // Similarly, vendored sources shouldn't be shown when running from a dist tarball. ++ rustc.arg("-Z").arg(format!( ++ "ignore-directory-in-diagnostics-source-blocks={}", ++ self.config.find_rust_src_root().unwrap().join("vendor").display(), ++ )); + + // Optionally prevent default --sysroot if specified in test compile-flags. + if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) +diff --git a/tests/ui/issues/issue-21763.rs b/tests/ui/issues/issue-21763.rs +index a349253063c02..1d0a0705cbbd9 100644 +--- a/tests/ui/issues/issue-21763.rs ++++ b/tests/ui/issues/issue-21763.rs +@@ -1,6 +1,6 @@ + // Regression test for HashMap only impl'ing Send/Sync if its contents do + +-// normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION" ++// normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION" + + use std::collections::HashMap; + use std::rc::Rc; diff --git a/mingw-w64-rust/PKGBUILD b/mingw-w64-rust/PKGBUILD index b0619bbd70d2c..63e569a37f666 100644 --- a/mingw-w64-rust/PKGBUILD +++ b/mingw-w64-rust/PKGBUILD @@ -52,7 +52,8 @@ source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc} "0008-disable-self-contained.patch" "0011-disable-uac-for-installer.patch" "0012-vendor-embed-manifest.patch" - "0013-backport-compiler-builtins.patch") + "0013-backport-compiler-builtins.patch" + "0014-fix-vendored-test.patch") noextract=(${_realname}c-${pkgver}-src.tar.gz) sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3' 'SKIP' @@ -64,7 +65,8 @@ sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3' '7a3b5722ff576b0661f36796f088dee4ce318b5dbc3fdcd65b48972de68a0edf' '761d73328d9695a7a2bd2a10be8225f4a56801fee54cbb51c0841b7f16e2bde6' '358de2f3e54afbe4aefd401725227becf2468763b7686c5d4fed3b71d1e95ce9' - '56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092') + '56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092' + '435b69f896f97b45108c92e748ef64edbc21566fe61188b643707aa51522d295') validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) '474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard 'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg @@ -124,6 +126,11 @@ prepare() { # still needs to patch .cargo-checksums.json apply_patch_with_msg \ 0013-backport-compiler-builtins.patch + + apply_patch_with_msg \ + 0014-fix-vendored-test.patch + # tidy complains about *.orig files so delete them + rm ${srcdir}/${_realname}c-${pkgver}-src/tests/ui/issues/*.orig } build() {