mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
feat: Load sysroot library via cargo metadata
This commit is contained in:
parent
670a5ab4a9
commit
f053b1aa6a
16 changed files with 156 additions and 212 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue