Skip to content

Commit fad3823

Browse files
committed
rename rustc_cfg::Config to rustc_cfg::RustcCfgConfig and import
1 parent 553152e commit fad3823

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

crates/project-model/src/rustc_cfg.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
77

88
use crate::{cfg_flag::CfgFlag, utf8_stdout, ManifestPath, Sysroot};
99

10-
pub(crate) enum Config<'a> {
10+
pub(crate) enum RustcCfgConfig<'a> {
1111
Cargo(&'a ManifestPath),
1212
Explicit(&'a Sysroot),
1313
Discover,
@@ -16,7 +16,7 @@ pub(crate) enum Config<'a> {
1616
pub(crate) fn get(
1717
target: Option<&str>,
1818
extra_env: &FxHashMap<String, String>,
19-
config: Config<'_>,
19+
config: RustcCfgConfig<'_>,
2020
) -> Vec<CfgFlag> {
2121
let _p = profile::span("rustc_cfg::get");
2222
let mut res = Vec::with_capacity(6 * 2 + 1);
@@ -61,10 +61,10 @@ pub(crate) fn get(
6161
fn get_rust_cfgs(
6262
target: Option<&str>,
6363
extra_env: &FxHashMap<String, String>,
64-
config: Config<'_>,
64+
config: RustcCfgConfig<'_>,
6565
) -> anyhow::Result<String> {
6666
let mut cmd = match config {
67-
Config::Cargo(cargo_toml) => {
67+
RustcCfgConfig::Cargo(cargo_toml) => {
6868
let mut cmd = Command::new(toolchain::cargo());
6969
cmd.envs(extra_env);
7070
cmd.current_dir(cargo_toml.parent())
@@ -76,12 +76,12 @@ fn get_rust_cfgs(
7676

7777
return utf8_stdout(cmd).context("Unable to run `cargo rustc`");
7878
}
79-
Config::Explicit(sysroot) => {
79+
RustcCfgConfig::Explicit(sysroot) => {
8080
let rustc: std::path::PathBuf = sysroot.discover_rustc()?.into();
8181
tracing::debug!(?rustc, "using explicit rustc from sysroot");
8282
Command::new(rustc)
8383
}
84-
Config::Discover => {
84+
RustcCfgConfig::Discover => {
8585
let rustc = toolchain::rustc();
8686
tracing::debug!(?rustc, "using rustc from env");
8787
Command::new(rustc)

crates/project-model/src/workspace.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use crate::{
2121
cargo_workspace::{DepKind, PackageData, RustLibSource},
2222
cfg_flag::CfgFlag,
2323
project_json::Crate,
24-
rustc_cfg,
24+
rustc_cfg::{self, RustcCfgConfig},
2525
sysroot::SysrootCrate,
2626
target_data_layout, utf8_stdout, CargoConfig, CargoWorkspace, InvocationStrategy, ManifestPath,
2727
Package, ProjectJson, ProjectManifest, Sysroot, TargetData, TargetKind, WorkspaceBuildScripts,
@@ -282,7 +282,7 @@ impl ProjectWorkspace {
282282
let rustc_cfg = rustc_cfg::get(
283283
config.target.as_deref(),
284284
&config.extra_env,
285-
rustc_cfg::Config::Cargo(cargo_toml),
285+
RustcCfgConfig::Cargo(cargo_toml),
286286
);
287287

288288
let cfg_overrides = config.cfg_overrides.clone();
@@ -337,11 +337,11 @@ impl ProjectWorkspace {
337337
let config = match &sysroot {
338338
Ok(sysroot) => {
339339
tracing::debug!(src_root = %sysroot.src_root(), root = %sysroot.root(), "Using sysroot");
340-
rustc_cfg::Config::Explicit(sysroot)
340+
RustcCfgConfig::Explicit(sysroot)
341341
}
342342
Err(_) => {
343343
tracing::debug!("discovering sysroot");
344-
rustc_cfg::Config::Discover
344+
RustcCfgConfig::Discover
345345
}
346346
};
347347

@@ -370,11 +370,11 @@ impl ProjectWorkspace {
370370
let rustc_config = match &sysroot {
371371
Ok(sysroot) => {
372372
tracing::info!(src_root = %sysroot.src_root(), root = %sysroot.root(), "Using sysroot");
373-
rustc_cfg::Config::Explicit(sysroot)
373+
RustcCfgConfig::Explicit(sysroot)
374374
}
375375
Err(_) => {
376376
tracing::info!("discovering sysroot");
377-
rustc_cfg::Config::Discover
377+
RustcCfgConfig::Discover
378378
}
379379
};
380380

@@ -774,8 +774,8 @@ fn project_json_to_crate_graph(
774774
let target_cfgs = match target.as_deref() {
775775
Some(target) => cfg_cache.entry(target).or_insert_with(|| {
776776
let rustc_cfg = match sysroot {
777-
Some(sysroot) => rustc_cfg::Config::Explicit(sysroot),
778-
None => rustc_cfg::Config::Discover,
777+
Some(sysroot) => RustcCfgConfig::Explicit(sysroot),
778+
None => RustcCfgConfig::Discover,
779779
};
780780

781781
rustc_cfg::get(Some(target), extra_env, rustc_cfg)

0 commit comments

Comments
 (0)