Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/project-model/src/workspace.rs7
-rw-r--r--crates/project-model/test_data/output/cargo_hello_world_project_model.txt2
-rw-r--r--crates/project-model/test_data/output/cargo_hello_world_project_model_with_selective_overrides.txt2
-rw-r--r--crates/project-model/test_data/output/cargo_hello_world_project_model_with_wildcard_overrides.txt2
-rw-r--r--crates/project-model/test_data/output/rust_project_hello_world_project_model.txt10
5 files changed, 5 insertions, 18 deletions
diff --git a/crates/project-model/src/workspace.rs b/crates/project-model/src/workspace.rs
index 6e7836f913..0904ef080d 100644
--- a/crates/project-model/src/workspace.rs
+++ b/crates/project-model/src/workspace.rs
@@ -867,6 +867,9 @@ fn cargo_to_crate_graph(
if cargo[pkg].is_local {
cfg_options.insert_atom("test".into());
}
+ if cargo[pkg].is_member {
+ cfg_options.insert_atom("rust_analyzer".into());
+ }
if !override_cfg.global.is_empty() {
cfg_options.apply_diff(override_cfg.global.clone());
@@ -1030,7 +1033,8 @@ fn detached_files_to_crate_graph(
None => (SysrootPublicDeps::default(), None),
};
- let cfg_options = create_cfg_options(rustc_cfg);
+ let mut cfg_options = create_cfg_options(rustc_cfg);
+ cfg_options.insert_atom("rust_analyzer".into());
for detached_file in detached_files {
let file_id = match load(detached_file) {
@@ -1479,6 +1483,5 @@ fn create_cfg_options(rustc_cfg: Vec<CfgFlag>) -> CfgOptions {
let mut cfg_options = CfgOptions::default();
cfg_options.extend(rustc_cfg);
cfg_options.insert_atom("debug_assertions".into());
- cfg_options.insert_atom("rust_analyzer".into());
cfg_options
}
diff --git a/crates/project-model/test_data/output/cargo_hello_world_project_model.txt b/crates/project-model/test_data/output/cargo_hello_world_project_model.txt
index b5e4937115..727d39a307 100644
--- a/crates/project-model/test_data/output/cargo_hello_world_project_model.txt
+++ b/crates/project-model/test_data/output/cargo_hello_world_project_model.txt
@@ -297,7 +297,6 @@
"debug_assertions",
"feature=default",
"feature=std",
- "rust_analyzer",
],
),
potential_cfg_options: Some(
@@ -311,7 +310,6 @@
"feature=rustc-dep-of-std",
"feature=std",
"feature=use_std",
- "rust_analyzer",
],
),
),
diff --git a/crates/project-model/test_data/output/cargo_hello_world_project_model_with_selective_overrides.txt b/crates/project-model/test_data/output/cargo_hello_world_project_model_with_selective_overrides.txt
index b5e4937115..727d39a307 100644
--- a/crates/project-model/test_data/output/cargo_hello_world_project_model_with_selective_overrides.txt
+++ b/crates/project-model/test_data/output/cargo_hello_world_project_model_with_selective_overrides.txt
@@ -297,7 +297,6 @@
"debug_assertions",
"feature=default",
"feature=std",
- "rust_analyzer",
],
),
potential_cfg_options: Some(
@@ -311,7 +310,6 @@
"feature=rustc-dep-of-std",
"feature=std",
"feature=use_std",
- "rust_analyzer",
],
),
),
diff --git a/crates/project-model/test_data/output/cargo_hello_world_project_model_with_wildcard_overrides.txt b/crates/project-model/test_data/output/cargo_hello_world_project_model_with_wildcard_overrides.txt
index 050791d64c..89728babd8 100644
--- a/crates/project-model/test_data/output/cargo_hello_world_project_model_with_wildcard_overrides.txt
+++ b/crates/project-model/test_data/output/cargo_hello_world_project_model_with_wildcard_overrides.txt
@@ -293,7 +293,6 @@
"debug_assertions",
"feature=default",
"feature=std",
- "rust_analyzer",
],
),
potential_cfg_options: Some(
@@ -307,7 +306,6 @@
"feature=rustc-dep-of-std",
"feature=std",
"feature=use_std",
- "rust_analyzer",
],
),
),
diff --git a/crates/project-model/test_data/output/rust_project_hello_world_project_model.txt b/crates/project-model/test_data/output/rust_project_hello_world_project_model.txt
index 24803e7d9a..b7bf6cb277 100644
--- a/crates/project-model/test_data/output/rust_project_hello_world_project_model.txt
+++ b/crates/project-model/test_data/output/rust_project_hello_world_project_model.txt
@@ -16,7 +16,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -58,7 +57,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -92,7 +90,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -126,7 +123,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -160,7 +156,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -209,7 +204,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -243,7 +237,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -334,7 +327,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -368,7 +360,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,
@@ -402,7 +393,6 @@
cfg_options: CfgOptions(
[
"debug_assertions",
- "rust_analyzer",
],
),
potential_cfg_options: None,