mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-28 05:53:45 +00:00
Remove version check before using --keep-going
This commit is contained in:
parent
8f841ca9a8
commit
8ecfdec3c3
2 changed files with 7 additions and 25 deletions
|
@ -18,7 +18,6 @@ use itertools::Itertools;
|
||||||
use la_arena::ArenaMap;
|
use la_arena::ArenaMap;
|
||||||
use paths::{AbsPath, AbsPathBuf};
|
use paths::{AbsPath, AbsPathBuf};
|
||||||
use rustc_hash::{FxHashMap, FxHashSet};
|
use rustc_hash::{FxHashMap, FxHashSet};
|
||||||
use semver::Version;
|
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use toolchain::Tool;
|
use toolchain::Tool;
|
||||||
|
|
||||||
|
@ -64,10 +63,8 @@ impl WorkspaceBuildScripts {
|
||||||
config: &CargoConfig,
|
config: &CargoConfig,
|
||||||
allowed_features: &FxHashSet<String>,
|
allowed_features: &FxHashSet<String>,
|
||||||
manifest_path: &ManifestPath,
|
manifest_path: &ManifestPath,
|
||||||
toolchain: Option<&Version>,
|
|
||||||
sysroot: &Sysroot,
|
sysroot: &Sysroot,
|
||||||
) -> io::Result<Command> {
|
) -> io::Result<Command> {
|
||||||
const RUST_1_75: Version = Version::new(1, 75, 0);
|
|
||||||
let mut cmd = match config.run_build_script_command.as_deref() {
|
let mut cmd = match config.run_build_script_command.as_deref() {
|
||||||
Some([program, args @ ..]) => {
|
Some([program, args @ ..]) => {
|
||||||
let mut cmd = Command::new(program);
|
let mut cmd = Command::new(program);
|
||||||
|
@ -122,9 +119,7 @@ impl WorkspaceBuildScripts {
|
||||||
cmd.arg("-Zscript");
|
cmd.arg("-Zscript");
|
||||||
}
|
}
|
||||||
|
|
||||||
if toolchain.map_or(false, |it| *it >= RUST_1_75) {
|
cmd.arg("--keep-going");
|
||||||
cmd.arg("--keep-going");
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd
|
cmd
|
||||||
}
|
}
|
||||||
|
@ -148,7 +143,6 @@ impl WorkspaceBuildScripts {
|
||||||
config: &CargoConfig,
|
config: &CargoConfig,
|
||||||
workspace: &CargoWorkspace,
|
workspace: &CargoWorkspace,
|
||||||
progress: &dyn Fn(String),
|
progress: &dyn Fn(String),
|
||||||
toolchain: Option<&Version>,
|
|
||||||
sysroot: &Sysroot,
|
sysroot: &Sysroot,
|
||||||
) -> io::Result<WorkspaceBuildScripts> {
|
) -> io::Result<WorkspaceBuildScripts> {
|
||||||
let current_dir = match &config.invocation_location {
|
let current_dir = match &config.invocation_location {
|
||||||
|
@ -160,13 +154,8 @@ impl WorkspaceBuildScripts {
|
||||||
.as_ref();
|
.as_ref();
|
||||||
|
|
||||||
let allowed_features = workspace.workspace_features();
|
let allowed_features = workspace.workspace_features();
|
||||||
let cmd = Self::build_command(
|
let cmd =
|
||||||
config,
|
Self::build_command(config, &allowed_features, workspace.manifest_path(), sysroot)?;
|
||||||
&allowed_features,
|
|
||||||
workspace.manifest_path(),
|
|
||||||
toolchain,
|
|
||||||
sysroot,
|
|
||||||
)?;
|
|
||||||
Self::run_per_ws(cmd, workspace, current_dir, progress)
|
Self::run_per_ws(cmd, workspace, current_dir, progress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +183,6 @@ impl WorkspaceBuildScripts {
|
||||||
&Default::default(),
|
&Default::default(),
|
||||||
// This is not gonna be used anyways, so just construct a dummy here
|
// This is not gonna be used anyways, so just construct a dummy here
|
||||||
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
|
&ManifestPath::try_from(workspace_root.clone()).unwrap(),
|
||||||
None,
|
|
||||||
&Sysroot::empty(),
|
&Sysroot::empty(),
|
||||||
)?;
|
)?;
|
||||||
// NB: Cargo.toml could have been modified between `cargo metadata` and
|
// NB: Cargo.toml could have been modified between `cargo metadata` and
|
||||||
|
|
|
@ -450,16 +450,10 @@ impl ProjectWorkspace {
|
||||||
match &self.kind {
|
match &self.kind {
|
||||||
ProjectWorkspaceKind::DetachedFile { cargo: Some((cargo, _)), .. }
|
ProjectWorkspaceKind::DetachedFile { cargo: Some((cargo, _)), .. }
|
||||||
| ProjectWorkspaceKind::Cargo { cargo, .. } => {
|
| ProjectWorkspaceKind::Cargo { cargo, .. } => {
|
||||||
WorkspaceBuildScripts::run_for_workspace(
|
WorkspaceBuildScripts::run_for_workspace(config, cargo, progress, &self.sysroot)
|
||||||
config,
|
.with_context(|| {
|
||||||
cargo,
|
format!("Failed to run build scripts for {}", cargo.workspace_root())
|
||||||
progress,
|
})
|
||||||
self.toolchain.as_ref(),
|
|
||||||
&self.sysroot,
|
|
||||||
)
|
|
||||||
.with_context(|| {
|
|
||||||
format!("Failed to run build scripts for {}", cargo.workspace_root())
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
ProjectWorkspaceKind::DetachedFile { cargo: None, .. }
|
ProjectWorkspaceKind::DetachedFile { cargo: None, .. }
|
||||||
| ProjectWorkspaceKind::Json { .. } => Ok(WorkspaceBuildScripts::default()),
|
| ProjectWorkspaceKind::Json { .. } => Ok(WorkspaceBuildScripts::default()),
|
||||||
|
|
Loading…
Reference in a new issue