Skip to content

Commit dee35d7

Browse files
committed
rust: fix issue-21763.rs test failure when vendor is enabled
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
1 parent 1374c43 commit dee35d7

File tree

2 files changed

+55
-2
lines changed

2 files changed

+55
-2
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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;

mingw-w64-rust/PKGBUILD

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ source=("${rust_dist_server}/${_realname}c-${pkgver}-src.tar.gz"{,.asc}
5252
"0008-disable-self-contained.patch"
5353
"0011-disable-uac-for-installer.patch"
5454
"0012-vendor-embed-manifest.patch"
55-
"0013-backport-compiler-builtins.patch")
55+
"0013-backport-compiler-builtins.patch"
56+
"0014-fix-vendored-test.patch")
5657
noextract=(${_realname}c-${pkgver}-src.tar.gz)
5758
sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3'
5859
'SKIP'
@@ -64,7 +65,8 @@ sha256sums=('c61457ef8f596638fddbc7716778b2f6b99ff12513a3b0f13994c3bc521638c3'
6465
'7a3b5722ff576b0661f36796f088dee4ce318b5dbc3fdcd65b48972de68a0edf'
6566
'761d73328d9695a7a2bd2a10be8225f4a56801fee54cbb51c0841b7f16e2bde6'
6667
'358de2f3e54afbe4aefd401725227becf2468763b7686c5d4fed3b71d1e95ce9'
67-
'56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092')
68+
'56e3433e37ecebe4e5eba1be8debb3e34451be22a00e345ee738bbeb37803092'
69+
'435b69f896f97b45108c92e748ef64edbc21566fe61188b643707aa51522d295')
6870
validpgpkeys=('108F66205EAEB0AAA8DD5E1C85AB96E6FA1BE5FE' # Rust Language (Tag and Release Signing Key) <[email protected]>
6971
'474E22316ABF4785A88C6E8EA2C794A986419D8A' # Tom Stellard <[email protected]>
7072
'B6C8F98282B944E3B0D5C2530FC3042E345AD05D') # Hans Wennborg <[email protected]>
@@ -124,6 +126,11 @@ prepare() {
124126
# still needs to patch .cargo-checksums.json
125127
apply_patch_with_msg \
126128
0013-backport-compiler-builtins.patch
129+
130+
apply_patch_with_msg \
131+
0014-fix-vendored-test.patch
132+
# tidy complains about *.orig files so delete them
133+
rm ${srcdir}/${_realname}c-${pkgver}-src/tests/ui/issues/*.orig
127134
}
128135

129136
build() {

0 commit comments

Comments
 (0)