Skip to content

Commit ac28b5b

Browse files
committed
Fix splitting dylib paths
1 parent c46f42d commit ac28b5b

File tree

1 file changed

+8
-10
lines changed
  • src/bootstrap/src/core/build_steps

1 file changed

+8
-10
lines changed

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//! However, this contains ~all test parts we expect people to be able to build and run locally.
55
66
use std::collections::HashSet;
7-
use std::env::join_paths;
7+
use std::env::split_paths;
88
use std::ffi::{OsStr, OsString};
99
use std::path::{Path, PathBuf};
1010
use std::{env, fs, iter};
@@ -34,8 +34,8 @@ use crate::core::config::flags::{Subcommand, get_completion};
3434
use crate::utils::build_stamp::{self, BuildStamp};
3535
use crate::utils::exec::{BootstrapCommand, command};
3636
use crate::utils::helpers::{
37-
self, LldThreads, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var, linker_args,
38-
linker_flags, t, target_supports_cranelift_backend, up_to_date,
37+
self, LldThreads, add_dylib_path, add_rustdoc_cargo_linker_args, dylib_path, dylib_path_var,
38+
linker_args, linker_flags, t, target_supports_cranelift_backend, up_to_date,
3939
};
4040
use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
4141
use crate::{CLang, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, debug, envify};
@@ -380,16 +380,14 @@ impl Step for Cargo {
380380
// libdir. That causes issues in cargo test, because the programs that cargo compiles are
381381
// incorrectly picking that libdir, even though they should be picking the
382382
// `tested_compiler`'s libdir. We thus have to override the precedence here.
383-
let existing_dylib_path = cargo
383+
let mut existing_dylib_paths = cargo
384384
.get_envs()
385385
.find(|(k, _)| *k == OsStr::new(dylib_path_var()))
386386
.and_then(|(_, v)| v)
387-
.unwrap_or(OsStr::new(""));
388-
cargo.env(
389-
dylib_path_var(),
390-
join_paths([builder.rustc_libdir(tested_compiler).as_ref(), existing_dylib_path])
391-
.unwrap_or_default(),
392-
);
387+
.map(|value| split_paths(value).collect::<Vec<PathBuf>>())
388+
.unwrap_or_default();
389+
existing_dylib_paths.insert(0, builder.rustc_libdir(tested_compiler));
390+
add_dylib_path(existing_dylib_paths, &mut cargo);
393391

394392
// Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is
395393
// relative to. Cargo no longer sets this env var, so we have to do that. This has to be the

0 commit comments

Comments
 (0)