about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-08 15:56:50 +0000
committerbors <bors@rust-lang.org>2024-07-08 15:56:50 +0000
commitfa29aa3a4f17def436da5c980550c55bce8eec49 (patch)
treeeaea638570bd79e21f46969d8e84943bf06d7e00
parent7e3303de2ffafb342489fc0c7d6e336f30781c20 (diff)
parenta8e90c8f4d0185dc0fba3324c24f54f9f1d38a84 (diff)
downloadrust-fa29aa3a4f17def436da5c980550c55bce8eec49.tar.gz
rust-fa29aa3a4f17def436da5c980550c55bce8eec49.zip
Auto merge of #17565 - mo8it:remove-version-check, r=Veykril
Remove version check before using `--keep-going`

See https://github.com/rust-lang/rust-analyzer/pull/17561#issuecomment-2214227971 by `@lnicola`
-rw-r--r--src/tools/rust-analyzer/crates/project-model/src/build_scripts.rs18
-rw-r--r--src/tools/rust-analyzer/crates/project-model/src/workspace.rs14
2 files changed, 7 insertions, 25 deletions
diff --git a/src/tools/rust-analyzer/crates/project-model/src/build_scripts.rs b/src/tools/rust-analyzer/crates/project-model/src/build_scripts.rs
index d2f423590e2..839d8e569fe 100644
--- a/src/tools/rust-analyzer/crates/project-model/src/build_scripts.rs
+++ b/src/tools/rust-analyzer/crates/project-model/src/build_scripts.rs
@@ -18,7 +18,6 @@ use itertools::Itertools;
 use la_arena::ArenaMap;
 use paths::{AbsPath, AbsPathBuf};
 use rustc_hash::{FxHashMap, FxHashSet};
-use semver::Version;
 use serde::Deserialize;
 use toolchain::Tool;
 
@@ -64,10 +63,8 @@ impl WorkspaceBuildScripts {
         config: &CargoConfig,
         allowed_features: &FxHashSet<String>,
         manifest_path: &ManifestPath,
-        toolchain: Option<&Version>,
         sysroot: &Sysroot,
     ) -> io::Result<Command> {
-        const RUST_1_75: Version = Version::new(1, 75, 0);
         let mut cmd = match config.run_build_script_command.as_deref() {
             Some([program, args @ ..]) => {
                 let mut cmd = Command::new(program);
@@ -122,9 +119,7 @@ impl WorkspaceBuildScripts {
                     cmd.arg("-Zscript");
                 }
 
-                if toolchain.map_or(false, |it| *it >= RUST_1_75) {
-                    cmd.arg("--keep-going");
-                }
+                cmd.arg("--keep-going");
 
                 cmd
             }
@@ -148,7 +143,6 @@ impl WorkspaceBuildScripts {
         config: &CargoConfig,
         workspace: &CargoWorkspace,
         progress: &dyn Fn(String),
-        toolchain: Option<&Version>,
         sysroot: &Sysroot,
     ) -> io::Result<WorkspaceBuildScripts> {
         let current_dir = match &config.invocation_location {
@@ -160,13 +154,8 @@ impl WorkspaceBuildScripts {
         .as_ref();
 
         let allowed_features = workspace.workspace_features();
-        let cmd = Self::build_command(
-            config,
-            &allowed_features,
-            workspace.manifest_path(),
-            toolchain,
-            sysroot,
-        )?;
+        let cmd =
+            Self::build_command(config, &allowed_features, workspace.manifest_path(), sysroot)?;
         Self::run_per_ws(cmd, workspace, current_dir, progress)
     }
 
@@ -194,7 +183,6 @@ impl WorkspaceBuildScripts {
             &Default::default(),
             // This is not gonna be used anyways, so just construct a dummy here
             &ManifestPath::try_from(workspace_root.clone()).unwrap(),
-            None,
             &Sysroot::empty(),
         )?;
         // NB: Cargo.toml could have been modified between `cargo metadata` and
diff --git a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
index 17e40e74de3..5e27ce29873 100644
--- a/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
+++ b/src/tools/rust-analyzer/crates/project-model/src/workspace.rs
@@ -450,16 +450,10 @@ impl ProjectWorkspace {
         match &self.kind {
             ProjectWorkspaceKind::DetachedFile { cargo: Some((cargo, _)), .. }
             | ProjectWorkspaceKind::Cargo { cargo, .. } => {
-                WorkspaceBuildScripts::run_for_workspace(
-                    config,
-                    cargo,
-                    progress,
-                    self.toolchain.as_ref(),
-                    &self.sysroot,
-                )
-                .with_context(|| {
-                    format!("Failed to run build scripts for {}", cargo.workspace_root())
-                })
+                WorkspaceBuildScripts::run_for_workspace(config, cargo, progress, &self.sysroot)
+                    .with_context(|| {
+                        format!("Failed to run build scripts for {}", cargo.workspace_root())
+                    })
             }
             ProjectWorkspaceKind::DetachedFile { cargo: None, .. }
             | ProjectWorkspaceKind::Json { .. } => Ok(WorkspaceBuildScripts::default()),