Skip to content

Commit

Permalink
rust: fix issue-21763.rs test failure when vendor is enabled
Browse files Browse the repository at this point in the history
the issue is fixed upstream in 1.79.0
see rust-lang/rust#123652

that fix requires a prior and massive commit
see cuviper/rust@ec2cc76
so a tailored patch was made
  • Loading branch information
filnet authored and jeremyd2019 committed Apr 22, 2024
1 parent f736f0b commit 1a7f7bf
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
46 changes: 46 additions & 0 deletions mingw-w64-rust/0014-fix-vendored-test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From f7b2e37f7232540d9f2b2dc6e33597fbb74f4f63 Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
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;
11 changes: 9 additions & 2 deletions mingw-w64-rust/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -64,7 +65,8 @@ sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3'
'7a3b5722ff576b0661f36796f088dee4ce318b5dbc3fdcd65b48972de68a0edf'
'761d73328d9695a7a2bd2a10be8225f4a56801fee54cbb51c0841b7f16e2bde6'
'358de2f3e54afbe4aefd401725227becf2468763b7686c5d4fed3b71d1e95ce9'
'56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092')
'56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092'
'435b69f896f97b45108c92e748ef64edbc21566fe61188b643707aa51522d295')
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <rust-key@rust-lang.org>
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <tstellar@redhat.com>
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <hans@chromium.org>
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 1a7f7bf

Please sign in to comment.