feat: Load sysroot library via cargo metadata

This commit is contained in:
Lukas Wirth 2024-08-05 12:18:19 +02:00
parent 670a5ab4a9
commit f053b1aa6a
16 changed files with 156 additions and 212 deletions

View file

@ -85,8 +85,6 @@ pub struct CargoConfig {
pub target: Option<String>,
/// Sysroot loading behavior
pub sysroot: Option<RustLibSource>,
/// Whether to invoke `cargo metadata` on the sysroot crate.
pub sysroot_query_metadata: bool,
pub sysroot_src: Option<AbsPathBuf>,
/// rustc private crate source
pub rustc_source: Option<RustLibSource>,
@ -259,6 +257,7 @@ impl CargoWorkspace {
current_dir: &AbsPath,
config: &CargoConfig,
sysroot: &Sysroot,
locked: bool,
progress: &dyn Fn(String),
) -> anyhow::Result<cargo_metadata::Metadata> {
let targets = find_list_of_build_targets(config, cargo_toml, sysroot);
@ -312,6 +311,9 @@ impl CargoWorkspace {
// opt into it themselves.
other_options.push("-Zscript".to_owned());
}
if locked {
other_options.push("--locked".to_owned());
}
meta.other_options(other_options);
// FIXME: Fetching metadata is a slow process, as it might require