diff options
| author | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-09-15 16:09:45 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro.albini@ferrous-systems.com> | 2023-09-15 16:22:52 +0200 |
| commit | c230637b92a3101a5b18141b75f94ada2edee776 (patch) | |
| tree | c9a50add0300321028a141917cb11ff12fa90d66 | |
| parent | d695b95e3beb872fef59d57bba0339f6b55f3e14 (diff) | |
| download | rust-c230637b92a3101a5b18141b75f94ada2edee776.tar.gz rust-c230637b92a3101a5b18141b75f94ada2edee776.zip | |
avoid blessing cargo deps's source code in ui tests
| -rw-r--r-- | Cargo.lock | 10 | ||||
| -rw-r--r-- | src/tools/compiletest/Cargo.toml | 1 | ||||
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 9 | ||||
| -rw-r--r-- | tests/ui/issues/issue-21763.stderr | 3 |
4 files changed, 20 insertions, 3 deletions
diff --git a/Cargo.lock b/Cargo.lock index 386b57e6a44..d0dde610500 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -662,6 +662,7 @@ dependencies = [ "diff", "getopts", "glob", + "home", "lazycell", "libc", "miow", @@ -1598,6 +1599,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] +name = "home" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +dependencies = [ + "windows-sys 0.48.0", +] + +[[package]] name = "html-checker" version = "0.1.0" dependencies = [ diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index ff1d5cecb72..bb1fa6e9237 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -24,6 +24,7 @@ walkdir = "2" glob = "0.3.0" lazycell = "1.3.0" anyhow = "1" +home = "0.5.5" [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 65af650f6e5..855df427538 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -2335,6 +2335,15 @@ impl<'test> TestCx<'test> { rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX"); rustc.arg("-Ztranslate-remapped-path-to-local-path=no"); + // Hide Cargo dependency sources from ui tests to make sure the error message doesn't + // change depending on whether $CARGO_HOME is remapped or not. If this is not present, + // when $CARGO_HOME is remapped the source won't be shown, and when it's not remapped the + // source will be shown, causing a blessing hell. + rustc.arg("-Z").arg(format!( + "ignore-directory-in-diagnostics-source-blocks={}", + home::cargo_home().expect("failed to find cargo home").to_str().unwrap() + )); + // Optionally prevent default --sysroot if specified in test compile-flags. if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot")) && !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot") diff --git a/tests/ui/issues/issue-21763.stderr b/tests/ui/issues/issue-21763.stderr index df50118ac47..a887635d354 100644 --- a/tests/ui/issues/issue-21763.stderr +++ b/tests/ui/issues/issue-21763.stderr @@ -9,9 +9,6 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>(); = note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send` note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>` --> $HASHBROWN_SRC_LOCATION - | -LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> { - | ^^^^^^^ note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>` --> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL note: required by a bound in `foo` |
