Skip to content

Commit 7e9eaba

Browse files
authored
Rollup merge of rust-lang#123652 - cuviper:ui-vendor, r=jieyouxu
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.
2 parents 55e0668 + f7b2e37 commit 7e9eaba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/tools/compiletest/src/runtest.rs

+5
Original file line numberDiff line numberDiff line change
@@ -2354,6 +2354,11 @@ impl<'test> TestCx<'test> {
23542354
"ignore-directory-in-diagnostics-source-blocks={}",
23552355
home::cargo_home().expect("failed to find cargo home").to_str().unwrap()
23562356
));
2357+
// Similarly, vendored sources shouldn't be shown when running from a dist tarball.
2358+
rustc.arg("-Z").arg(format!(
2359+
"ignore-directory-in-diagnostics-source-blocks={}",
2360+
self.config.find_rust_src_root().unwrap().join("vendor").display(),
2361+
));
23572362

23582363
// Optionally prevent default --sysroot if specified in test compile-flags.
23592364
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))

tests/ui/issues/issue-21763.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Regression test for HashMap only impl'ing Send/Sync if its contents do
22

3-
//@ normalize-stderr-test: "\S+hashbrown-\S+" -> "$$HASHBROWN_SRC_LOCATION"
3+
//@ normalize-stderr-test: "\S+[\\/]hashbrown\S+" -> "$$HASHBROWN_SRC_LOCATION"
44

55
use std::collections::HashMap;
66
use std::rc::Rc;

0 commit comments

Comments
 (0)