|
4 | 4 | //! However, this contains ~all test parts we expect people to be able to build and run locally.
|
5 | 5 |
|
6 | 6 | use std::collections::HashSet;
|
7 |
| -use std::env::join_paths; |
| 7 | +use std::env::split_paths; |
8 | 8 | use std::ffi::{OsStr, OsString};
|
9 | 9 | use std::path::{Path, PathBuf};
|
10 | 10 | use std::{env, fs, iter};
|
@@ -34,8 +34,8 @@ use crate::core::config::flags::{Subcommand, get_completion};
|
34 | 34 | use crate::utils::build_stamp::{self, BuildStamp};
|
35 | 35 | use crate::utils::exec::{BootstrapCommand, command};
|
36 | 36 | 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, |
39 | 39 | };
|
40 | 40 | use crate::utils::render_tests::{add_flags_and_try_run_tests, try_run_tests};
|
41 | 41 | use crate::{CLang, CodegenBackendKind, DocTests, GitRepo, Mode, PathSet, debug, envify};
|
@@ -380,16 +380,14 @@ impl Step for Cargo {
|
380 | 380 | // libdir. That causes issues in cargo test, because the programs that cargo compiles are
|
381 | 381 | // incorrectly picking that libdir, even though they should be picking the
|
382 | 382 | // `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 |
384 | 384 | .get_envs()
|
385 | 385 | .find(|(k, _)| *k == OsStr::new(dylib_path_var()))
|
386 | 386 | .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); |
393 | 391 |
|
394 | 392 | // Cargo's test suite uses `CARGO_RUSTC_CURRENT_DIR` to determine the path that `file!` is
|
395 | 393 | // relative to. Cargo no longer sets this env var, so we have to do that. This has to be the
|
|
0 commit comments