Skip to content

Commit

Permalink
Rollup merge of rust-lang#113611 - jyn514:download-rustc-hashbrown, r…
Browse files Browse the repository at this point in the history
…=ozkanonur

Remap paths for ~/.cargo in UI tests

Users won't have the original cargo registry from the CI builder available, even if they have `rust-src` installed. Don't show their sources in UI tests even if they're available. As a happy side-effect, this fixes a few UI tests when download-rustc is enabled.

Helps with rust-lang#112143.
  • Loading branch information
matthiaskrgr authored Jul 12, 2023
2 parents 491ac78 + 702c0ac commit e9faff8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,16 @@ impl<'a> Builder<'a> {
cargo.env("RUSTC_HOST_CRT_STATIC", x.to_string());
}

// Users won't have the original cargo registry from the CI builder available, even if they have `rust-src` installed.
// Don't show their sources in UI tests even if they're available.
// As a happy side-effect, this fixes a few UI tests when download-rustc is enabled.
// NOTE: only set this when building std so the error messages are better for rustc itself.
if mode == Mode::Std {
let cargo_home =
env::var("CARGO_HOME").unwrap_or_else(|_| env::var("HOME").unwrap() + "/.cargo");
rustflags.arg(&format!("--remap-path-prefix={cargo_home}=/cargo/FAKE_PREFIX"));
}

if let Some(map_to) = self.build.debuginfo_map_to(GitRepo::Rustc) {
let map = format!("{}={}", self.build.src.display(), map_to);
cargo.env("RUSTC_DEBUGINFO_MAP", map);
Expand Down
3 changes: 0 additions & 3 deletions tests/ui/issues/issue-21763.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit e9faff8

Please sign in to comment.