Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove unused sysroot_host_libdir #13468

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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