Skip to content

Commit bbecea0

Browse files
committed
Revert "Support disabling rustc build scripts"
This reverts commit ddce6bb.
1 parent ddce6bb commit bbecea0

File tree

10 files changed

+12
-60
lines changed

10 files changed

+12
-60
lines changed

crates/project_model/src/workspace.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,19 +274,12 @@ impl ProjectWorkspace {
274274
crate_graph
275275
}
276276

277-
pub fn collect_build_data_configs(
278-
&self,
279-
collector: &mut BuildDataCollector,
280-
for_private: bool,
281-
) {
277+
pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) {
282278
match self {
283279
ProjectWorkspace::Cargo { cargo, rustc, .. } => {
284280
collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone());
285-
if for_private {
286-
if let Some(rustc) = rustc {
287-
collector
288-
.add_config(rustc.workspace_root(), rustc.build_data_config().clone());
289-
}
281+
if let Some(rustc) = rustc {
282+
collector.add_config(rustc.workspace_root(), rustc.build_data_config().clone());
290283
}
291284
}
292285
_ => {}

crates/rust-analyzer/src/cli/analysis_bench.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ impl BenchCmd {
6868
let load_cargo_config = LoadCargoConfig {
6969
load_out_dirs_from_check: self.load_output_dirs,
7070
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,
7471
};
7572
let (mut host, vfs, _proc_macro) =
7673
load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;

crates/rust-analyzer/src/cli/analysis_stats.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ impl AnalysisStatsCmd {
6363
let load_cargo_config = LoadCargoConfig {
6464
load_out_dirs_from_check: self.load_output_dirs,
6565
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,
6966
};
7067
let (host, vfs, _proc_macro) =
7168
load_workspace_at(&self.path, &cargo_config, &load_cargo_config, &|_| {})?;

crates/rust-analyzer/src/cli/diagnostics.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,7 @@ pub fn diagnostics(
3434
with_proc_macro: bool,
3535
) -> Result<()> {
3636
let cargo_config = Default::default();
37-
let load_cargo_config = LoadCargoConfig {
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-
};
37+
let load_cargo_config = LoadCargoConfig { load_out_dirs_from_check, with_proc_macro };
4438
let (host, _vfs, _proc_macro) =
4539
load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
4640
let db = host.raw_database();

crates/rust-analyzer/src/cli/load_cargo.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use vfs::{loader::Handle, AbsPath, AbsPathBuf};
1414
use crate::reload::{ProjectFolders, SourceRootConfig};
1515

1616
pub struct LoadCargoConfig {
17-
pub run_rustc_build_scripts: bool,
1817
pub load_out_dirs_from_check: bool,
1918
pub with_proc_macro: bool,
2019
}
@@ -54,7 +53,7 @@ pub fn load_workspace(
5453

5554
let build_data = if config.load_out_dirs_from_check {
5655
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);
5857
Some(collector.collect(progress)?)
5958
} else {
6059
None
@@ -137,11 +136,8 @@ mod tests {
137136
fn test_loading_rust_analyzer() -> Result<()> {
138137
let path = Path::new(env!("CARGO_MANIFEST_DIR")).parent().unwrap().parent().unwrap();
139138
let cargo_config = Default::default();
140-
let load_cargo_config = LoadCargoConfig {
141-
load_out_dirs_from_check: false,
142-
with_proc_macro: false,
143-
run_rustc_build_scripts: false,
144-
};
139+
let load_cargo_config =
140+
LoadCargoConfig { load_out_dirs_from_check: false, with_proc_macro: false };
145141
let (host, _vfs, _proc_macro) =
146142
load_workspace_at(path, &cargo_config, &load_cargo_config, &|_| {})?;
147143

crates/rust-analyzer/src/cli/ssr.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,8 @@ use ide_ssr::{MatchFinder, SsrPattern, SsrRule};
99
pub fn apply_ssr_rules(rules: Vec<SsrRule>) -> Result<()> {
1010
use ide_db::base_db::SourceDatabaseExt;
1111
let cargo_config = Default::default();
12-
let load_cargo_config = LoadCargoConfig {
13-
load_out_dirs_from_check: 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-
};
12+
let load_cargo_config =
13+
LoadCargoConfig { load_out_dirs_from_check: true, with_proc_macro: true };
1914
let (host, vfs, _proc_macro) =
2015
load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
2116
let db = host.raw_database();
@@ -41,13 +36,8 @@ pub fn search_for_patterns(patterns: Vec<SsrPattern>, debug_snippet: Option<Stri
4136
use ide_db::base_db::SourceDatabaseExt;
4237
use ide_db::symbol_index::SymbolsDatabase;
4338
let cargo_config = Default::default();
44-
let load_cargo_config = LoadCargoConfig {
45-
load_out_dirs_from_check: 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-
};
39+
let load_cargo_config =
40+
LoadCargoConfig { load_out_dirs_from_check: true, with_proc_macro: true };
5141
let (host, _vfs, _proc_macro) =
5242
load_workspace_at(&std::env::current_dir()?, &cargo_config, &load_cargo_config, &|_| {})?;
5343
let db = host.raw_database();

crates/rust-analyzer/src/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ config_data! {
4949
/// Run build scripts (`build.rs`) for more precise code analysis.
5050
cargo_runBuildScripts |
5151
cargo_loadOutDirsFromCheck: bool = "false",
52-
/// Disable running build scripts (`build.rs`) for the `rustc_private` crates in `rustcSource`.
53-
cargo_disableRustcBuildScripts: bool = "false",
5452
/// Do not activate the `default` feature.
5553
cargo_noDefaultFeatures: bool = "false",
5654
/// Compilation target (target triple).
@@ -484,9 +482,6 @@ impl Config {
484482
pub fn run_build_scripts(&self) -> bool {
485483
self.data.cargo_runBuildScripts || self.data.procMacro_enable
486484
}
487-
pub fn run_rustc_build_scripts(&self) -> bool {
488-
self.run_build_scripts() && !self.data.cargo_disableRustcBuildScripts
489-
}
490485
pub fn cargo(&self) -> CargoConfig {
491486
let rustc_source = self.data.rustcSource.as_ref().map(|rustc_src| {
492487
if rustc_src == "discover" {

crates/rust-analyzer/src/reload.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,7 @@ impl GlobalState {
340340
if self.config.run_build_scripts() && workspace_build_data.is_none() {
341341
let mut collector = BuildDataCollector::default();
342342
for ws in &workspaces {
343-
ws.collect_build_data_configs(
344-
&mut collector,
345-
self.config.run_rustc_build_scripts(),
346-
);
343+
ws.collect_build_data_configs(&mut collector);
347344
}
348345
self.fetch_build_data_request(collector)
349346
}

docs/user/generated_config.adoc

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
List of features to activate.
1313
[[rust-analyzer.cargo.runBuildScripts]]rust-analyzer.cargo.runBuildScripts (default: `false`)::
1414
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`.
1715
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
1816
Do not activate the `default` feature.
1917
[[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`)::

editors/code/package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -413,11 +413,6 @@
413413
"default": false,
414414
"type": "boolean"
415415
},
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-
},
421416
"rust-analyzer.cargo.noDefaultFeatures": {
422417
"markdownDescription": "Do not activate the `default` feature.",
423418
"default": false,

0 commit comments

Comments
 (0)