Skip to content

Commit c230637

Browse files
committed
avoid blessing cargo deps's source code in ui tests
1 parent d695b95 commit c230637

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

Cargo.lock

+10
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,7 @@ dependencies = [
662662
"diff",
663663
"getopts",
664664
"glob",
665+
"home",
665666
"lazycell",
666667
"libc",
667668
"miow",
@@ -1597,6 +1598,15 @@ version = "0.4.3"
15971598
source = "registry+https://github.com/rust-lang/crates.io-index"
15981599
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
15991600

1601+
[[package]]
1602+
name = "home"
1603+
version = "0.5.5"
1604+
source = "registry+https://github.com/rust-lang/crates.io-index"
1605+
checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb"
1606+
dependencies = [
1607+
"windows-sys 0.48.0",
1608+
]
1609+
16001610
[[package]]
16011611
name = "html-checker"
16021612
version = "0.1.0"

src/tools/compiletest/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ walkdir = "2"
2424
glob = "0.3.0"
2525
lazycell = "1.3.0"
2626
anyhow = "1"
27+
home = "0.5.5"
2728

2829
[target.'cfg(unix)'.dependencies]
2930
libc = "0.2"

src/tools/compiletest/src/runtest.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2335,6 +2335,15 @@ impl<'test> TestCx<'test> {
23352335
rustc.arg("-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX");
23362336
rustc.arg("-Ztranslate-remapped-path-to-local-path=no");
23372337

2338+
// Hide Cargo dependency sources from ui tests to make sure the error message doesn't
2339+
// change depending on whether $CARGO_HOME is remapped or not. If this is not present,
2340+
// when $CARGO_HOME is remapped the source won't be shown, and when it's not remapped the
2341+
// source will be shown, causing a blessing hell.
2342+
rustc.arg("-Z").arg(format!(
2343+
"ignore-directory-in-diagnostics-source-blocks={}",
2344+
home::cargo_home().expect("failed to find cargo home").to_str().unwrap()
2345+
));
2346+
23382347
// Optionally prevent default --sysroot if specified in test compile-flags.
23392348
if !self.props.compile_flags.iter().any(|flag| flag.starts_with("--sysroot"))
23402349
&& !self.config.host_rustcflags.iter().any(|flag| flag == "--sysroot")

tests/ui/issues/issue-21763.stderr

-3
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ LL | foo::<HashMap<Rc<()>, Rc<()>>>();
99
= note: required for `hashbrown::raw::RawTable<(Rc<()>, Rc<()>)>` to implement `Send`
1010
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>, RandomState>`
1111
--> $HASHBROWN_SRC_LOCATION
12-
|
13-
LL | pub struct HashMap<K, V, S = DefaultHashBuilder, A: Allocator + Clone = Global> {
14-
| ^^^^^^^
1512
note: required because it appears within the type `HashMap<Rc<()>, Rc<()>>`
1613
--> $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
1714
note: required by a bound in `foo`

0 commit comments

Comments
 (0)