Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Commit

Permalink
Update cargo
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Apr 19, 2020
1 parent 2659cbf commit 5e0ad40
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 39 deletions.
37 changes: 13 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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 = "bda50510d1daf6e9c53ad6ccf603da6e0fa8103f" }
cargo = { git = "https://github.com/rust-lang/cargo", rev = "5b620dc044e8999e6bc0193f9e037c4618519547" }
cargo_metadata = "0.8"
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "d236b30a1d638340aad8345fa2946cfe9543dcf0", optional = true }
env_logger = "0.7"
Expand Down
8 changes: 4 additions & 4 deletions rls/src/build/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,19 +356,19 @@ impl Executor for RlsExecutor {
/// unit of work (may still be modified for runtime-known dependencies, when
/// the work is actually executed). This is called even for a target that
/// is fresh and won't be compiled.
fn init<'a>(&self, cx: &Context<'a, '_>, unit: &Unit<'a>) {
fn init<'a>(&self, cx: &Context<'a, '_>, unit: &Unit) {
let mut compilation_cx = self.compilation_cx.lock().unwrap();
let plan = compilation_cx
.build_plan
.as_cargo_mut()
.expect("build plan should be properly initialized before running Cargo");

let only_primary = |unit: Unit<'_>| self.is_primary_package(unit.pkg.package_id());
let only_primary = |unit: &Unit| self.is_primary_package(unit.pkg.package_id());

plan.emplace_dep_with_filter(*unit, cx, &only_primary);
plan.emplace_dep_with_filter(unit, cx, &only_primary);
}

fn force_rebuild(&self, unit: &Unit<'_>) -> bool {
fn force_rebuild(&self, unit: &Unit) -> bool {
// We need to force rebuild every package in the
// workspace, even if it's not dirty at a time, to cache compiler
// invocations in the build plan.
Expand Down
20 changes: 10 additions & 10 deletions rls/src/build/cargo_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,11 @@ impl CargoPlan {
/// out by the `filter` closure.
pub(crate) fn emplace_dep_with_filter<'a, Filter>(
&mut self,
unit: Unit<'a>,
unit: &Unit,
cx: &Context<'a, '_>,
filter: &Filter,
) where
Filter: Fn(Unit<'a>) -> bool,
Filter: Fn(&Unit) -> bool,
{
if !filter(unit) {
return;
Expand All @@ -150,13 +150,13 @@ impl CargoPlan {
self.units.insert(key.clone(), unit.into());

// Fetch and insert relevant unit dependencies to the forward dep graph.
let deps = cx.unit_deps(&unit);
let deps = cx.unit_deps(unit);
let dep_keys: HashSet<UnitKey> = deps
.iter()
.map(|dep| dep.unit)
.map(|dep| &dep.unit)
// We might not want certain deps to be added transitively (e.g.
// when creating only a sub-dep-graph, limiting the scope).
.filter(|unit| filter(*unit))
.filter(|unit| filter(unit))
.map(UnitKey::from)
// Units can depend on others with different Targets or Profiles
// (e.g. different `run_custom_build`) despite having the same UnitKey.
Expand All @@ -175,7 +175,7 @@ impl CargoPlan {

// Recursively process other remaining forward dependencies.
for dep in deps {
self.emplace_dep_with_filter(dep.unit, cx, filter);
self.emplace_dep_with_filter(&dep.unit, cx, filter);
}
}

Expand Down Expand Up @@ -464,8 +464,8 @@ impl PackageMap {
}
}

impl From<Unit<'_>> for UnitKey {
fn from(unit: Unit<'_>) -> UnitKey {
impl From<&Unit> for UnitKey {
fn from(unit: &Unit) -> UnitKey {
UnitKey { pkg_id: unit.pkg.package_id(), target: unit.target.clone(), mode: unit.mode }
}
}
Expand All @@ -480,8 +480,8 @@ pub(crate) struct OwnedUnit {
pub(crate) mode: CompileMode,
}

impl From<Unit<'_>> for OwnedUnit {
fn from(unit: Unit<'_>) -> OwnedUnit {
impl From<&Unit> for OwnedUnit {
fn from(unit: &Unit) -> OwnedUnit {
OwnedUnit {
id: unit.pkg.package_id().to_owned(),
target: unit.target.clone(),
Expand Down

0 comments on commit 5e0ad40

Please sign in to comment.