aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/project_model/src/workspace.rs13
-rw-r--r--crates/rust-analyzer/src/cli/analysis_bench.rs3
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs3
-rw-r--r--crates/rust-analyzer/src/cli/diagnostics.rs8
-rw-r--r--crates/rust-analyzer/src/cli/load_cargo.rs10
-rw-r--r--crates/rust-analyzer/src/cli/ssr.rs18
-rw-r--r--crates/rust-analyzer/src/config.rs5
-rw-r--r--crates/rust-analyzer/src/reload.rs5
-rw-r--r--docs/user/generated_config.adoc2
-rw-r--r--editors/code/package.json5
10 files changed, 12 insertions, 60 deletions
diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs
index d754c8b55..aa7a8ee52 100644
--- a/crates/project_model/src/workspace.rs
+++ b/crates/project_model/src/workspace.rs
@@ -274,19 +274,12 @@ impl ProjectWorkspace {
274 crate_graph 274 crate_graph
275 } 275 }
276 276
277 pub fn collect_build_data_configs( 277 pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) {
278 &self,
279 collector: &mut BuildDataCollector,
280 for_private: bool,
281 ) {
282 match self { 278 match self {
283 ProjectWorkspace::Cargo { cargo, rustc, .. } => { 279 ProjectWorkspace::Cargo { cargo, rustc, .. } => {
284 collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone()); 280 collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone());
285 if for_private { 281 if let Some(rustc) = rustc {
286 if let Some(rustc) = rustc { 282 collector.add_config(rustc.workspace_root(), rustc.build_data_config().clone());
287 collector
288 .add_config(rustc.workspace_root(), rustc.build_data_config().clone());
289 }
290 } 283 }
291 } 284 }
292 _ => {} 285 _ => {}
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs
index 104f2e8a2..3bd7e678d 100644
--- a/crates/rust-analyzer/src/cli/analysis_bench.rs
+++ b/crates/rust-analyzer/src/cli/analysis_bench.rs
@@ -68,9 +68,6 @@ impl BenchCmd {
68 let load_cargo_config = LoadCargoConfig { 68 let load_cargo_config = LoadCargoConfig {
69 load_out_dirs_from_check: self.load_output_dirs, 69 load_out_dirs_from_check: self.load_output_dirs,
70 with_proc_macro: self.with_proc_macro, 70 with_proc_macro: self.with_proc_macro,
71 // This will currently never have rustcSource set, however if in
72 // future it does this will handle that case
73 run_rustc_build_scripts: true,
74 }; 71 };
75 let (mut host, vfs, _proc_macro) = 72 let (mut host, vfs, _proc_macro) =
76 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?; 73 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 5a8432960..ad0759bda 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -63,9 +63,6 @@ impl AnalysisStatsCmd {
63 let load_cargo_config = LoadCargoConfig { 63 let load_cargo_config = LoadCargoConfig {
64 load_out_dirs_from_check: self.load_output_dirs, 64 load_out_dirs_from_check: self.load_output_dirs,
65 with_proc_macro: self.with_proc_macro, 65 with_proc_macro: self.with_proc_macro,
66 // This will currently never have rustcSource set, however if in
67 // future it does this will handle that case
68 run_rustc_build_scripts: true,
69 }; 66 };
70 let (host, vfs, _proc_macro) = 67 let (host, vfs, _proc_macro) =
71 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?; 68 load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;
diff --git a/crates/rust-analyzer/src/cli/diagnostics.rs b/crates/rust-analyzer/src/cli/diagnostics.rs
index e1966b5a7..8b985716b 100644
--- a/crates/rust-analyzer/src/cli/diagnostics.rs
+++ b/crates/rust-analyzer/src/cli/diagnostics.rs
@@ -34,13 +34,7 @@ pub fn diagnostics(
34 with_proc_macro: bool, 34 with_proc_macro: bool,
35) -> Result<()> { 35) -> Result<()> {
36 let cargo_config = Default::default(); 36 let cargo_config = Default::default();
37 let load_cargo_config = LoadCargoConfig { 37 let load_cargo_config = LoadCargoConfig { load_out_dirs_from_check, with_proc_macro };
38 load_out_dirs_from_check,
39 with_proc_macro,
40 // This will currently never have rustcSource set, however if in
41 // future it does this will handle that case
42 run_rustc_build_scripts: true,
43 };
44 let (host, _vfs, _proc_macro) = 38 let (host, _vfs, _proc_macro) =
45 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; 39 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
46 let db = host.raw_database(); 40 let db = host.raw_database();
diff --git a/crates/rust-analyzer/src/cli/load_cargo.rs b/crates/rust-analyzer/src/cli/load_cargo.rs
index 3d7b5031a..310c36904 100644
--- a/crates/rust-analyzer/src/cli/load_cargo.rs
+++ b/crates/rust-analyzer/src/cli/load_cargo.rs
@@ -14,7 +14,6 @@ use vfs::{loader::Handle, AbsPath, AbsPathBuf};
14use crate::reload::{ProjectFolders, SourceRootConfig}; 14use crate::reload::{ProjectFolders, SourceRootConfig};
15 15
16pub struct LoadCargoConfig { 16pub struct LoadCargoConfig {
17 pub run_rustc_build_scripts: bool,
18 pub load_out_dirs_from_check: bool, 17 pub load_out_dirs_from_check: bool,
19 pub with_proc_macro: bool, 18 pub with_proc_macro: bool,
20} 19}
@@ -54,7 +53,7 @@ pub fn load_workspace(
54 53
55 let build_data = if config.load_out_dirs_from_check { 54 let build_data = if config.load_out_dirs_from_check {
56 let mut collector = BuildDataCollector::default(); 55 let mut collector = BuildDataCollector::default();
57 ws.collect_build_data_configs(&mut collector, config.run_rustc_build_scripts); 56 ws.collect_build_data_configs(&mut collector);
58 Some(collector.collect(progress)?) 57 Some(collector.collect(progress)?)
59 } else { 58 } else {
60 None 59 None
@@ -137,11 +136,8 @@ mod tests {
137 fn test_loading_rust_analyzer() -> Result<()> { 136 fn test_loading_rust_analyzer() -> Result<()> {
138 let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap(); 137 let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap();
139 let cargo_config = Default::default(); 138 let cargo_config = Default::default();
140 let load_cargo_config = LoadCargoConfig { 139 let load_cargo_config =
141 load_out_dirs_from_check: false, 140 LoadCargoConfig { load_out_dirs_from_check: false, with_proc_macro: false };
142 with_proc_macro: false,
143 run_rustc_build_scripts: false,
144 };
145 let (host, _vfs, _proc_macro) = 141 let (host, _vfs, _proc_macro) =
146 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?; 142 load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
147 143
diff --git a/crates/rust-analyzer/src/cli/ssr.rs b/crates/rust-analyzer/src/cli/ssr.rs
index 8cc4eefc2..79f426fff 100644
--- a/crates/rust-analyzer/src/cli/ssr.rs
+++ b/crates/rust-analyzer/src/cli/ssr.rs
@@ -9,13 +9,8 @@ use ide_ssr::{MatchFinder, SsrPattern, SsrRule};
9pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> { 9pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
10 use ide_db::base_db::SourceDatabaseExt; 10 use ide_db::base_db::SourceDatabaseExt;
11 let cargo_config = Default::default(); 11 let cargo_config = Default::default();
12 let load_cargo_config = LoadCargoConfig { 12 let load_cargo_config =
13 load_out_dirs_from_check: true, 13 LoadCargoConfig { load_out_dirs_from_check: true, with_proc_macro: true };
14 with_proc_macro: true,
15 // This will currently never have rustcSource set, however if in
16 // future it does this will handle that case
17 run_rustc_build_scripts: true,
18 };
19 let (host, vfs, _proc_macro) = 14 let (host, vfs, _proc_macro) =
20 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; 15 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
21 let db = host.raw_database(); 16 let db = host.raw_database();
@@ -41,13 +36,8 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri
41 use ide_db::base_db::SourceDatabaseExt; 36 use ide_db::base_db::SourceDatabaseExt;
42 use ide_db::symbol_index::SymbolsDatabase; 37 use ide_db::symbol_index::SymbolsDatabase;
43 let cargo_config = Default::default(); 38 let cargo_config = Default::default();
44 let load_cargo_config = LoadCargoConfig { 39 let load_cargo_config =
45 load_out_dirs_from_check: true, 40 LoadCargoConfig { load_out_dirs_from_check: true, with_proc_macro: true };
46 with_proc_macro: true,
47 // This will currently never have rustcSource set, however if in
48 // future it does this will handle that case
49 run_rustc_build_scripts: true,
50 };
51 let (host, _vfs, _proc_macro) = 41 let (host, _vfs, _proc_macro) =
52 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?; 42 load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
53 let db = host.raw_database(); 43 let db = host.raw_database();
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index cbec8fce2..367136702 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -49,8 +49,6 @@ config_data! {
49 /// Run build scripts (`build.rs`) for more precise code analysis. 49 /// Run build scripts (`build.rs`) for more precise code analysis.
50 cargo_runBuildScripts | 50 cargo_runBuildScripts |
51 cargo_loadOutDirsFromCheck: bool = "false", 51 cargo_loadOutDirsFromCheck: bool = "false",
52 /// Disable running build scripts (`build.rs`) for the `rustc_private` crates in `rustcSource`.
53 cargo_disableRustcBuildScripts: bool = "false",
54 /// Do not activate the `default` feature. 52 /// Do not activate the `default` feature.
55 cargo_noDefaultFeatures: bool = "false", 53 cargo_noDefaultFeatures: bool = "false",
56 /// Compilation target (target triple). 54 /// Compilation target (target triple).
@@ -484,9 +482,6 @@ impl Config {
484 pub fn run_build_scripts(&self) -> bool { 482 pub fn run_build_scripts(&self) -> bool {
485 self.data.cargo_runBuildScripts || self.data.procMacro_enable 483 self.data.cargo_runBuildScripts || self.data.procMacro_enable
486 } 484 }
487 pub fn run_rustc_build_scripts(&self) -> bool {
488 self.run_build_scripts() && !self.data.cargo_disableRustcBuildScripts
489 }
490 pub fn cargo(&self) -> CargoConfig { 485 pub fn cargo(&self) -> CargoConfig {
491 let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| { 486 let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {
492 if rustc_src == "discover" { 487 if rustc_src == "discover" {
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index da02be2de..aa8504c3d 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -340,10 +340,7 @@ impl GlobalState {
340 if self.config.run_build_scripts() && workspace_build_data.is_none() { 340 if self.config.run_build_scripts() && workspace_build_data.is_none() {
341 let mut collector = BuildDataCollector::default(); 341 let mut collector = BuildDataCollector::default();
342 for ws in &workspaces { 342 for ws in &workspaces {
343 ws.collect_build_data_configs( 343 ws.collect_build_data_configs(&mut collector);
344 &mut collector,
345 self.config.run_rustc_build_scripts(),
346 );
347 } 344 }
348 self.fetch_build_data_request(collector) 345 self.fetch_build_data_request(collector)
349 } 346 }
diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc
index 602c9432e..1dbf2a611 100644
--- a/docs/user/generated_config.adoc
+++ b/docs/user/generated_config.adoc
@@ -12,8 +12,6 @@
12 List of features to activate. 12 List of features to activate.
13[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`):: 13[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`)::
14 Run build scripts (`build.rs`) for more precise code analysis. 14 Run build scripts (`build.rs`) for more precise code analysis.
15[[rust-analyzer.cargo.disableRustcBuildScripts]]rust-analyzer.cargo.disableRustcBuildScripts (default: `false`)::
16 Disable running build scripts (`build.rs`) for the `rustc_private` crates in `rustcSource`.
17[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: 15[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
18 Do not activate the `default` feature. 16 Do not activate the `default` feature.
19[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: 17[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::
diff --git a/editors/code/package.json b/editors/code/package.json
index 82011bb44..1987364bc 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -413,11 +413,6 @@
413 "default": false, 413 "default": false,
414 "type": "boolean" 414 "type": "boolean"
415 }, 415 },
416 "rust-analyzer.cargo.disableRustcBuildScripts": {
417 "markdownDescription": "Disable running build scripts (`build.rs`) for the `rustc_private` crates in `rustcSource`.",
418 "default": false,
419 "type": "boolean"
420 },
421 "rust-analyzer.cargo.noDefaultFeatures": { 416 "rust-analyzer.cargo.noDefaultFeatures": {
422 "markdownDescription": "Do not activate the `default` feature.", 417 "markdownDescription": "Do not activate the `default` feature.",
423 "default": false, 418 "default": false,