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

Commit 7de2a1f

Browse files
committedApr 19, 2020
Auto merge of #1663 - ehuss:update-cargo, r=Xanewok
Update cargo The lifetime for `Unit` has been removed (it uses an inner `Rc` now).
2 parents 2659cbf + 5e0ad40 commit 7de2a1f

File tree

4 files changed

+28
-39
lines changed

4 files changed

+28
-39
lines changed
 

‎Cargo.lock

+13-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rls-vfs = "0.8"
3030
rls-ipc = { version = "0.1.0", path = "rls-ipc", optional = true }
3131

3232
anyhow = "1.0.26"
33-
cargo = { git = "https://github.com/rust-lang/cargo", rev = "bda50510d1daf6e9c53ad6ccf603da6e0fa8103f" }
33+
cargo = { git = "https://github.com/rust-lang/cargo", rev = "5b620dc044e8999e6bc0193f9e037c4618519547" }
3434
cargo_metadata = "0.8"
3535
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "d236b30a1d638340aad8345fa2946cfe9543dcf0", optional = true }
3636
env_logger = "0.7"

‎rls/src/build/cargo.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,19 @@ impl Executor for RlsExecutor {
356356
/// unit of work (may still be modified for runtime-known dependencies, when
357357
/// the work is actually executed). This is called even for a target that
358358
/// is fresh and won't be compiled.
359-
fn init<'a>(&self, cx: &Context<'a, '_>, unit: &Unit<'a>) {
359+
fn init<'a>(&self, cx: &Context<'a, '_>, unit: &Unit) {
360360
let mut compilation_cx = self.compilation_cx.lock().unwrap();
361361
let plan = compilation_cx
362362
.build_plan
363363
.as_cargo_mut()
364364
.expect("build plan should be properly initialized before running Cargo");
365365

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

368-
plan.emplace_dep_with_filter(*unit, cx, &only_primary);
368+
plan.emplace_dep_with_filter(unit, cx, &only_primary);
369369
}
370370

371-
fn force_rebuild(&self, unit: &Unit<'_>) -> bool {
371+
fn force_rebuild(&self, unit: &Unit) -> bool {
372372
// We need to force rebuild every package in the
373373
// workspace, even if it's not dirty at a time, to cache compiler
374374
// invocations in the build plan.

‎rls/src/build/cargo_plan.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,11 @@ impl CargoPlan {
127127
/// out by the `filter` closure.
128128
pub(crate) fn emplace_dep_with_filter<'a, Filter>(
129129
&mut self,
130-
unit: Unit<'a>,
130+
unit: &Unit,
131131
cx: &Context<'a, '_>,
132132
filter: &Filter,
133133
) where
134-
Filter: Fn(Unit<'a>) -> bool,
134+
Filter: Fn(&Unit) -> bool,
135135
{
136136
if !filter(unit) {
137137
return;
@@ -150,13 +150,13 @@ impl CargoPlan {
150150
self.units.insert(key.clone(), unit.into());
151151

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

176176
// Recursively process other remaining forward dependencies.
177177
for dep in deps {
178-
self.emplace_dep_with_filter(dep.unit, cx, filter);
178+
self.emplace_dep_with_filter(&dep.unit, cx, filter);
179179
}
180180
}
181181

@@ -464,8 +464,8 @@ impl PackageMap {
464464
}
465465
}
466466

467-
impl From<Unit<'_>> for UnitKey {
468-
fn from(unit: Unit<'_>) -> UnitKey {
467+
impl From<&Unit> for UnitKey {
468+
fn from(unit: &Unit) -> UnitKey {
469469
UnitKey { pkg_id: unit.pkg.package_id(), target: unit.target.clone(), mode: unit.mode }
470470
}
471471
}
@@ -480,8 +480,8 @@ pub(crate) struct OwnedUnit {
480480
pub(crate) mode: CompileMode,
481481
}
482482

483-
impl From<Unit<'_>> for OwnedUnit {
484-
fn from(unit: Unit<'_>) -> OwnedUnit {
483+
impl From<&Unit> for OwnedUnit {
484+
fn from(unit: &Unit) -> OwnedUnit {
485485
OwnedUnit {
486486
id: unit.pkg.package_id().to_owned(),
487487
target: unit.target.clone(),

0 commit comments

Comments
 (0)
This repository has been archived.