From a2f6ea4f9f3a8ddb98b7f3ccfe7ec3c0ca6782e1 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 23 Mar 2021 11:54:35 -0700 Subject: [PATCH] Update cargo --- Cargo.lock | 38 +++++++++++++++++++++++++++---------- Cargo.toml | 3 ++- rls/src/build/cargo.rs | 15 +++++++++------ rls/src/build/cargo_plan.rs | 2 +- rls/src/build/external.rs | 4 ++-- rls/src/build/plan.rs | 2 +- rls/src/project_model.rs | 13 +++++++++++-- 7 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2fcf55a9054..362ae678184 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -153,17 +153,16 @@ checksum = "81a18687293a1546b67c246452202bbbf143d239cb43494cc163da14979082da" [[package]] name = "cargo" version = "0.53.0" -source = "git+https://github.com/rust-lang/cargo?rev=970bc67c3775781b9708c8a36893576b9459c64a#970bc67c3775781b9708c8a36893576b9459c64a" +source = "git+https://github.com/rust-lang/cargo?rev=58a961314437258065e23cb6316dfc121d96fb71#58a961314437258065e23cb6316dfc121d96fb71" dependencies = [ "anyhow", "atty", "bytesize", "cargo-platform", + "cargo-util", "clap", - "core-foundation", "crates-io", "crossbeam-utils 0.8.1", - "crypto-hash", "curl", "curl-sys", "env_logger 0.8.2", @@ -185,19 +184,16 @@ dependencies = [ "libgit2-sys", "log", "memchr", - "miow 0.3.6", "num_cpus", "opener", "percent-encoding 2.1.0", "rand 0.8.3", "rustc-workspace-hack", "rustfix", - "same-file", "semver 0.10.0", "serde", "serde_ignored", "serde_json", - "shell-escape", "strip-ansi-escapes", "tar", "tempfile", @@ -213,11 +209,32 @@ dependencies = [ [[package]] name = "cargo-platform" version = "0.1.1" -source = "git+https://github.com/rust-lang/cargo?rev=970bc67c3775781b9708c8a36893576b9459c64a#970bc67c3775781b9708c8a36893576b9459c64a" +source = "git+https://github.com/rust-lang/cargo?rev=58a961314437258065e23cb6316dfc121d96fb71#58a961314437258065e23cb6316dfc121d96fb71" dependencies = [ "serde", ] +[[package]] +name = "cargo-util" +version = "0.1.0" +source = "git+https://github.com/rust-lang/cargo?rev=58a961314437258065e23cb6316dfc121d96fb71#58a961314437258065e23cb6316dfc121d96fb71" +dependencies = [ + "anyhow", + "core-foundation", + "crypto-hash", + "filetime", + "hex 0.4.2", + "jobserver", + "libc", + "log", + "miow 0.3.6", + "same-file", + "shell-escape", + "tempfile", + "walkdir", + "winapi 0.3.9", +] + [[package]] name = "cargo_metadata" version = "0.8.2" @@ -375,7 +392,7 @@ checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" [[package]] name = "crates-io" version = "0.33.0" -source = "git+https://github.com/rust-lang/cargo?rev=970bc67c3775781b9708c8a36893576b9459c64a#970bc67c3775781b9708c8a36893576b9459c64a" +source = "git+https://github.com/rust-lang/cargo?rev=58a961314437258065e23cb6316dfc121d96fb71#58a961314437258065e23cb6316dfc121d96fb71" dependencies = [ "anyhow", "curl", @@ -1250,9 +1267,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.85" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +checksum = "8916b1f6ca17130ec6568feccee27c156ad12037880833a3b842a823236502e7" [[package]] name = "libgit2-sys" @@ -1934,6 +1951,7 @@ version = "1.41.0" dependencies = [ "anyhow", "cargo", + "cargo-util", "cargo_metadata 0.8.2", "clippy_lints 0.0.212 (git+https://github.com/rust-lang/rust-clippy?rev=7ea7cd165ad6705603852771bf82cc2fd6560db5)", "crossbeam-channel", diff --git a/Cargo.toml b/Cargo.toml index 996485e6d65..836a06f7c96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,8 @@ rls-vfs = "0.8" rls-ipc = { version = "0.1.0", path = "rls-ipc", optional = true } anyhow = "1.0.26" -cargo = { git = "https://github.com/rust-lang/cargo", rev = "970bc67c3775781b9708c8a36893576b9459c64a" } +cargo = { git = "https://github.com/rust-lang/cargo", rev = "58a961314437258065e23cb6316dfc121d96fb71" } +cargo-util = { git = "https://github.com/rust-lang/cargo", rev = "58a961314437258065e23cb6316dfc121d96fb71" } cargo_metadata = "0.8" clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "7ea7cd165ad6705603852771bf82cc2fd6560db5", optional = true } env_logger = "0.7" diff --git a/rls/src/build/cargo.rs b/rls/src/build/cargo.rs index d2aa9a3c869..4f58d74d37d 100644 --- a/rls/src/build/cargo.rs +++ b/rls/src/build/cargo.rs @@ -10,14 +10,15 @@ use std::sync::{Arc, Mutex}; use std::thread; use cargo::core::compiler::{BuildConfig, CompileMode, Context, Executor, Unit}; -use cargo::core::resolver::ResolveError; +use cargo::core::resolver::{CliFeatures, ResolveError}; use cargo::core::Package; use cargo::core::{PackageId, Shell, Target, TargetKind, Verbosity, Workspace}; use cargo::ops::{compile_with_exec, CompileFilter, CompileOptions, Packages}; use cargo::util::{ config as cargo_config, errors::ManifestError, homedir, important_paths, CargoResult, - ConfigValue, ProcessBuilder, + ConfigValue, }; +use cargo_util::ProcessBuilder; use log::{debug, trace, warn}; use rls_data::Analysis; use rls_vfs::Vfs; @@ -229,9 +230,11 @@ fn run_cargo_ws( opts.target.iter().map(|x| x.into()).collect::>().as_slice(), CompileMode::Check { test: cfg_test }, )?, - features: opts.features, - all_features: opts.all_features, - no_default_features: opts.no_default_features, + cli_features: CliFeatures::from_command_line( + &opts.features, + opts.all_features, + !opts.no_default_features, + )?, ..CompileOptions::new(&config, CompileMode::Check { test: cfg_test })? }; @@ -266,7 +269,7 @@ fn run_cargo_ws( // directory but its parent) and, when user runs "cargo build" themselves cargo will see // target/ existing already and won't exclude it from backups. We can work around that by // attempting to create a backup-excluded target/ ourelves using cargo paths:: machinery. - cargo::util::paths::create_dir_all_excluded_from_backups_atomic( + cargo_util::paths::create_dir_all_excluded_from_backups_atomic( config.target_dir().unwrap().unwrap().as_path_unlocked().parent().unwrap(), )?; let exec = Arc::new(exec) as Arc; diff --git a/rls/src/build/cargo_plan.rs b/rls/src/build/cargo_plan.rs index edc989c0de8..b82c57b7fcd 100644 --- a/rls/src/build/cargo_plan.rs +++ b/rls/src/build/cargo_plan.rs @@ -22,7 +22,7 @@ use std::sync::Mutex; use cargo::core::compiler::{CompileKind, CompileMode, Context, Unit}; use cargo::core::profiles::Profile; use cargo::core::{PackageId, Target, TargetKind}; -use cargo::util::ProcessBuilder; +use cargo_util::ProcessBuilder; use log::{error, trace}; use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus}; diff --git a/rls/src/build/external.rs b/rls/src/build/external.rs index 04e36564375..2863221b55b 100644 --- a/rls/src/build/external.rs +++ b/rls/src/build/external.rs @@ -23,7 +23,7 @@ use crate::build::plan::{BuildGraph, BuildKey, JobQueue, WorkStatus}; use crate::build::rustc::src_path; use crate::build::BuildResult; -use cargo::util::{process, ProcessBuilder}; +use cargo_util::ProcessBuilder; use log::trace; use rls_data::{Analysis, CompilationOptions}; use serde_derive::Deserialize; @@ -217,7 +217,7 @@ impl BuildKey for Invocation { impl Invocation { fn from_raw(build_dir: &Path, raw: RawInvocation) -> Invocation { - let mut command = process(&raw.program); + let mut command = ProcessBuilder::new(&raw.program); command.args(&raw.args); for (k, v) in &raw.env { command.env(&k, v); diff --git a/rls/src/build/plan.rs b/rls/src/build/plan.rs index e821409e6ac..cf89c9e8adb 100644 --- a/rls/src/build/plan.rs +++ b/rls/src/build/plan.rs @@ -12,7 +12,7 @@ use std::path::{Path, PathBuf}; use std::sync::mpsc::Sender; use std::sync::Arc; -use cargo::util::ProcessBuilder; +use cargo_util::ProcessBuilder; use log::trace; use serde::{Deserialize, Serialize}; diff --git a/rls/src/project_model.rs b/rls/src/project_model.rs index 4b5fae5cef5..15c666fec0e 100644 --- a/rls/src/project_model.rs +++ b/rls/src/project_model.rs @@ -3,7 +3,7 @@ use cargo::{ core::{ registry::PackageRegistry, - resolver::{EncodableResolve, Resolve, ResolveOpts}, + resolver::{CliFeatures, EncodableResolve, HasDevUnits, Resolve}, PackageId, Workspace, }, ops, @@ -217,5 +217,14 @@ fn resolve_with_prev<'cfg>( ws: &Workspace<'cfg>, prev: Option<&Resolve>, ) -> CargoResult { - ops::resolve_with_previous(registry, ws, &ResolveOpts::everything(), prev, None, &[], true) + ops::resolve_with_previous( + registry, + ws, + &CliFeatures::new_all(true), + HasDevUnits::Yes, + prev, + None, + &[], + true, + ) }