about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Barsky <me@davidbarsky.com>2023-09-07 15:19:04 -0400
committerDavid Barsky <me@davidbarsky.com>2023-09-07 15:19:04 -0400
commitfad3823a20c453907ee311953fedc69b7ca11d8d (patch)
tree99cdbcd90a490abf482d6fc4eefda0012743451a
parent553152e2d568dd06406bd1cb93c2a6fe86a579e6 (diff)
downloadrust-fad3823a20c453907ee311953fedc69b7ca11d8d.tar.gz
rust-fad3823a20c453907ee311953fedc69b7ca11d8d.zip
rename `rustc_cfg::Config` to `rustc_cfg::RustcCfgConfig` and import
-rw-r--r--crates/project-model/src/rustc_cfg.rs12
-rw-r--r--crates/project-model/src/workspace.rs16
2 files changed, 14 insertions, 14 deletions
diff --git a/crates/project-model/src/rustc_cfg.rs b/crates/project-model/src/rustc_cfg.rs
index d6e041b3adf..f4af7b0d2f0 100644
--- a/crates/project-model/src/rustc_cfg.rs
+++ b/crates/project-model/src/rustc_cfg.rs
@@ -7,7 +7,7 @@ use rustc_hash::FxHashMap;
 
 use crate::{cfg_flag::CfgFlag, utf8_stdout, ManifestPath, Sysroot};
 
-pub(crate) enum Config<'a> {
+pub(crate) enum RustcCfgConfig<'a> {
     Cargo(&'a ManifestPath),
     Explicit(&'a Sysroot),
     Discover,
@@ -16,7 +16,7 @@ pub(crate) enum Config<'a> {
 pub(crate) fn get(
     target: Option<&str>,
     extra_env: &FxHashMap<String, String>,
-    config: Config<'_>,
+    config: RustcCfgConfig<'_>,
 ) -> Vec<CfgFlag> {
     let _p = profile::span("rustc_cfg::get");
     let mut res = Vec::with_capacity(6 * 2 + 1);
@@ -61,10 +61,10 @@ pub(crate) fn get(
 fn get_rust_cfgs(
     target: Option<&str>,
     extra_env: &FxHashMap<String, String>,
-    config: Config<'_>,
+    config: RustcCfgConfig<'_>,
 ) -> anyhow::Result<String> {
     let mut cmd = match config {
-        Config::Cargo(cargo_toml) => {
+        RustcCfgConfig::Cargo(cargo_toml) => {
             let mut cmd = Command::new(toolchain::cargo());
             cmd.envs(extra_env);
             cmd.current_dir(cargo_toml.parent())
@@ -76,12 +76,12 @@ fn get_rust_cfgs(
 
             return utf8_stdout(cmd).context("Unable to run `cargo rustc`");
         }
-        Config::Explicit(sysroot) => {
+        RustcCfgConfig::Explicit(sysroot) => {
             let rustc: std::path::PathBuf = sysroot.discover_rustc()?.into();
             tracing::debug!(?rustc, "using explicit rustc from sysroot");
             Command::new(rustc)
         }
-        Config::Discover => {
+        RustcCfgConfig::Discover => {
             let rustc = toolchain::rustc();
             tracing::debug!(?rustc, "using rustc from env");
             Command::new(rustc)
diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs
index 6add6bf3b63..5d6c21d5972 100644
--- a/crates/project-model/src/workspace.rs
+++ b/crates/project-model/src/workspace.rs
@@ -21,7 +21,7 @@ use crate::{
     cargo_workspace::{DepKind, PackageData, RustLibSource},
     cfg_flag::CfgFlag,
     project_json::Crate,
-    rustc_cfg,
+    rustc_cfg::{self, RustcCfgConfig},
     sysroot::SysrootCrate,
     target_data_layout, utf8_stdout, CargoConfig, CargoWorkspace, InvocationStrategy, ManifestPath,
     Package, ProjectJson, ProjectManifest, Sysroot, TargetData, TargetKind, WorkspaceBuildScripts,
@@ -282,7 +282,7 @@ impl ProjectWorkspace {
                 let rustc_cfg = rustc_cfg::get(
                     config.target.as_deref(),
                     &config.extra_env,
-                    rustc_cfg::Config::Cargo(cargo_toml),
+                    RustcCfgConfig::Cargo(cargo_toml),
                 );
 
                 let cfg_overrides = config.cfg_overrides.clone();
@@ -337,11 +337,11 @@ impl ProjectWorkspace {
         let config = match &sysroot {
             Ok(sysroot) => {
                 tracing::debug!(src_root = %sysroot.src_root(), root = %sysroot.root(), "Using sysroot");
-                rustc_cfg::Config::Explicit(sysroot)
+                RustcCfgConfig::Explicit(sysroot)
             }
             Err(_) => {
                 tracing::debug!("discovering sysroot");
-                rustc_cfg::Config::Discover
+                RustcCfgConfig::Discover
             }
         };
 
@@ -370,11 +370,11 @@ impl ProjectWorkspace {
         let rustc_config = match &sysroot {
             Ok(sysroot) => {
                 tracing::info!(src_root = %sysroot.src_root(), root = %sysroot.root(), "Using sysroot");
-                rustc_cfg::Config::Explicit(sysroot)
+                RustcCfgConfig::Explicit(sysroot)
             }
             Err(_) => {
                 tracing::info!("discovering sysroot");
-                rustc_cfg::Config::Discover
+                RustcCfgConfig::Discover
             }
         };
 
@@ -774,8 +774,8 @@ fn project_json_to_crate_graph(
                 let target_cfgs = match target.as_deref() {
                     Some(target) => cfg_cache.entry(target).or_insert_with(|| {
                         let rustc_cfg = match sysroot {
-                            Some(sysroot) => rustc_cfg::Config::Explicit(sysroot),
-                            None => rustc_cfg::Config::Discover,
+                            Some(sysroot) => RustcCfgConfig::Explicit(sysroot),
+                            None => RustcCfgConfig::Discover,
                         };
 
                         rustc_cfg::get(Some(target), extra_env, rustc_cfg)