mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Discover rustc_cfg through unstable cargo options
This commit is contained in:
parent
526040eea8
commit
8989fb8315
3 changed files with 83 additions and 33 deletions
|
@ -143,7 +143,8 @@ impl ProjectWorkspace {
|
|||
} else {
|
||||
None
|
||||
};
|
||||
let rustc_cfg = rustc_cfg::get(config.target.as_deref());
|
||||
|
||||
let rustc_cfg = rustc_cfg::get(Some(&cargo_toml), config.target.as_deref());
|
||||
ProjectWorkspace::Cargo { cargo, sysroot, rustc, rustc_cfg }
|
||||
}
|
||||
};
|
||||
|
@ -159,7 +160,7 @@ impl ProjectWorkspace {
|
|||
Some(path) => Some(Sysroot::load(path)?),
|
||||
None => None,
|
||||
};
|
||||
let rustc_cfg = rustc_cfg::get(target);
|
||||
let rustc_cfg = rustc_cfg::get(None, target);
|
||||
Ok(ProjectWorkspace::Json { project: project_json, sysroot, rustc_cfg })
|
||||
}
|
||||
|
||||
|
@ -310,7 +311,7 @@ fn project_json_to_crate_graph(
|
|||
|
||||
let target_cfgs = match krate.target.as_deref() {
|
||||
Some(target) => {
|
||||
cfg_cache.entry(target).or_insert_with(|| rustc_cfg::get(Some(target)))
|
||||
cfg_cache.entry(target).or_insert_with(|| rustc_cfg::get(None, Some(target)))
|
||||
}
|
||||
None => &rustc_cfg,
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue