diff --git a/src/cargo/core/compiler/build_context/target_info.rs b/src/cargo/core/compiler/build_context/target_info.rs index 864196e1ca17..fcb4074e96ed 100644 --- a/src/cargo/core/compiler/build_context/target_info.rs +++ b/src/cargo/core/compiler/build_context/target_info.rs @@ -48,9 +48,6 @@ pub struct TargetInfo { support_split_debuginfo: Vec, /// Path to the sysroot. pub sysroot: PathBuf, - /// Path to the "lib" or "bin" directory that rustc uses for its dynamic - /// libraries. - pub sysroot_host_libdir: PathBuf, /// Path to the "lib" directory in the sysroot which rustc uses for linking /// target libraries. pub sysroot_target_libdir: PathBuf, @@ -224,19 +221,17 @@ impl TargetInfo { return error_missing_print_output("sysroot", &process, &output, &error); }; let sysroot = PathBuf::from(line); - let sysroot_host_libdir = if cfg!(windows) { - sysroot.join("bin") - } else { - sysroot.join("lib") + let sysroot_target_libdir = { + let mut libdir = sysroot.clone(); + libdir.push("lib"); + libdir.push("rustlib"); + libdir.push(match &kind { + CompileKind::Host => rustc.host.as_str(), + CompileKind::Target(target) => target.short_name(), + }); + libdir.push("lib"); + libdir }; - let mut sysroot_target_libdir = sysroot.clone(); - sysroot_target_libdir.push("lib"); - sysroot_target_libdir.push("rustlib"); - sysroot_target_libdir.push(match &kind { - CompileKind::Host => rustc.host.as_str(), - CompileKind::Target(target) => target.short_name(), - }); - sysroot_target_libdir.push("lib"); let support_split_debuginfo = { // HACK: abuse `--print=crate-name` to use `___` as a delimiter. @@ -303,7 +298,6 @@ impl TargetInfo { crate_type_process, crate_types: RefCell::new(map), sysroot, - sysroot_host_libdir, sysroot_target_libdir, rustflags, rustdocflags: extra_args( diff --git a/src/cargo/core/compiler/compilation.rs b/src/cargo/core/compiler/compilation.rs index f6ddf34b07d2..018792d2b135 100644 --- a/src/cargo/core/compiler/compilation.rs +++ b/src/cargo/core/compiler/compilation.rs @@ -74,9 +74,6 @@ pub struct Compilation<'gctx> { /// May be for the host or for a specific target. pub deps_output: HashMap, - /// The path to the host libdir for the compiler used - sysroot_host_libdir: PathBuf, - /// The path to libstd for each target sysroot_target_libdir: HashMap, @@ -128,11 +125,6 @@ impl<'gctx> Compilation<'gctx> { native_dirs: BTreeSet::new(), root_output: HashMap::new(), deps_output: HashMap::new(), - sysroot_host_libdir: bcx - .target_data - .info(CompileKind::Host) - .sysroot_host_libdir - .clone(), sysroot_target_libdir: get_sysroot_target_libdir(bcx)?, tests: Vec::new(), binaries: Vec::new(), @@ -282,7 +274,6 @@ impl<'gctx> Compilation<'gctx> { let mut search_path = Vec::new(); if is_rustc_tool { search_path.push(self.deps_output[&CompileKind::Host].clone()); - search_path.push(self.sysroot_host_libdir.clone()); } else { search_path.extend(super::filter_dynamic_search_path( self.native_dirs.iter(),