Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/project-model/src/rustc_cfg.rs')
| -rw-r--r-- | crates/project-model/src/rustc_cfg.rs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/crates/project-model/src/rustc_cfg.rs b/crates/project-model/src/rustc_cfg.rs index 486cb143b8..3231361836 100644 --- a/crates/project-model/src/rustc_cfg.rs +++ b/crates/project-model/src/rustc_cfg.rs @@ -3,13 +3,14 @@ use std::process::Command; use anyhow::Result; +use rustc_hash::FxHashMap; -use crate::{cfg_flag::CfgFlag, utf8_stdout, CargoConfig, ManifestPath}; +use crate::{cfg_flag::CfgFlag, utf8_stdout, ManifestPath}; pub(crate) fn get( cargo_toml: Option<&ManifestPath>, target: Option<&str>, - config: &CargoConfig, + extra_env: &FxHashMap<String, String>, ) -> Vec<CfgFlag> { let _p = profile::span("rustc_cfg::get"); let mut res = Vec::with_capacity(6 * 2 + 1); @@ -22,7 +23,7 @@ pub(crate) fn get( } } - match get_rust_cfgs(cargo_toml, target, config) { + match get_rust_cfgs(cargo_toml, target, extra_env) { Ok(rustc_cfgs) => { tracing::debug!( "rustc cfgs found: {:?}", @@ -42,11 +43,11 @@ pub(crate) fn get( fn get_rust_cfgs( cargo_toml: Option<&ManifestPath>, target: Option<&str>, - config: &CargoConfig, + extra_env: &FxHashMap<String, String>, ) -> Result<String> { if let Some(cargo_toml) = cargo_toml { let mut cargo_config = Command::new(toolchain::cargo()); - cargo_config.envs(&config.extra_env); + cargo_config.envs(extra_env); cargo_config .current_dir(cargo_toml.parent()) .args(&["-Z", "unstable-options", "rustc", "--print", "cfg"]) @@ -61,7 +62,7 @@ fn get_rust_cfgs( } // using unstable cargo features failed, fall back to using plain rustc let mut cmd = Command::new(toolchain::rustc()); - cmd.envs(&config.extra_env); + cmd.envs(extra_env); cmd.args(&["--print", "cfg", "-O"]); if let Some(target) = target { cmd.args(&["--target", target]); |