Skip to content

Commit

Permalink
Auto merge of #13468 - weihanglo:remove-host-libdir, r=ehuss
Browse files Browse the repository at this point in the history
fix: remove unused `sysroot_host_libdir`
  • Loading branch information
bors committed Feb 21, 2024
2 parents 3d47dd4 + 4402b5c commit 194a60b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 25 deletions.
26 changes: 10 additions & 16 deletions src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ pub struct TargetInfo {
support_split_debuginfo: Vec<String>,
/// 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,
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 0 additions & 9 deletions src/cargo/core/compiler/compilation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ pub struct Compilation<'gctx> {
/// May be for the host or for a specific target.
pub deps_output: HashMap<CompileKind, PathBuf>,

/// 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<CompileKind, PathBuf>,

Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit 194a60b

Please sign in to comment.