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

Commit

Permalink
Merge pull request #1160 from ehuss/update-cargo
Browse files Browse the repository at this point in the history
Update cargo.
  • Loading branch information
Xanewok committed Dec 3, 2018
2 parents 6610526 + 77ff073 commit cfd8449
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 20 deletions.
29 changes: 23 additions & 6 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 @@ -11,7 +11,7 @@ categories = ["development-tools"]
build = "build.rs"

[dependencies]
cargo = { git = "https://github.com/rust-lang/cargo", rev = "b3d0b2e545b61d4cd08096911724b7d49d213f73" }
cargo = { git = "https://github.com/rust-lang/cargo", rev = "5e85ba14aaa20f8133863373404cb0af69eeef2c" }
cargo_metadata = "0.6"
clippy_lints = { git = "https://github.com/rust-lang/rust-clippy", rev = "754b4c07233ee18820265bd18467aa82263f9a3a", optional = true }
env_logger = "0.5"
Expand Down
8 changes: 4 additions & 4 deletions src/build/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ impl RlsExecutor {
/// Returns whether a given package is a primary one (every member of the
/// workspace is considered as such). Used to determine whether the RLS
/// should cache invocations for these packages and rebuild them on changes.
fn is_primary_package(&self, id: &PackageId) -> bool {
id.source_id().is_path() || self.member_packages.lock().unwrap().contains(id)
fn is_primary_package(&self, id: PackageId) -> bool {
id.source_id().is_path() || self.member_packages.lock().unwrap().contains(&id)
}
}

Expand Down Expand Up @@ -413,7 +413,7 @@ impl Executor for RlsExecutor {
fn exec(
&self,
mut cargo_cmd: ProcessBuilder,
id: &PackageId,
id: PackageId,
target: &Target,
mode: CompileMode,
) -> CargoResult<()> {
Expand Down Expand Up @@ -840,7 +840,7 @@ impl ManifestAwareError {
if let Some(member) = resolve_err
.package_path()
.iter()
.filter_map(|pkg| ws.members().find(|m| m.package_id() == pkg))
.filter_map(|pkg| ws.members().find(|m| m.package_id() == *pkg))
.next()
{
err_path = member.manifest_path();
Expand Down
6 changes: 3 additions & 3 deletions src/build/cargo_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,18 @@ impl CargoPlan {
/// cached build plan.
crate fn cache_compiler_job(
&mut self,
id: &PackageId,
id: PackageId,
target: &Target,
mode: CompileMode,
cmd: &ProcessBuilder,
) {
let unit_key = (id.clone(), target.clone(), mode);
let unit_key = (id, target.clone(), mode);
self.compiler_jobs.insert(unit_key, cmd.clone());
}

crate fn cache_input_files(
&mut self,
id: &PackageId,
id: PackageId,
target: &Target,
mode: CompileMode,
input_files: Vec<PathBuf>,
Expand Down
12 changes: 6 additions & 6 deletions src/project_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ impl ProjectModel {
let mut registry = PackageRegistry::new(ws.config())?;
let resolve = resolve_with_prev(&mut registry, &ws, prev.as_ref())?;
let cargo_packages = {
let ids: Vec<PackageId> = resolve.iter().cloned().collect();
let ids: Vec<PackageId> = resolve.iter().collect();
registry.get(&ids)?
};
let mut pkg_id_to_pkg = HashMap::new();
let mut manifest_to_id = HashMap::new();
let mut packages = Vec::new();
for (idx, pkg_id) in resolve.iter().enumerate() {
let pkg = Package(idx);
pkg_id_to_pkg.insert(pkg_id.clone(), pkg);
pkg_id_to_pkg.insert(pkg_id, pkg);
let cargo_pkg = cargo_packages.get_one(pkg_id)?;
let manifest = cargo_pkg.manifest_path().to_owned();
packages.push(PackageData {
Expand All @@ -92,14 +92,14 @@ impl ProjectModel {
manifest_to_id.insert(manifest, pkg);
}
for pkg_id in resolve.iter() {
for (dep_id, _) in resolve.deps(&pkg_id) {
for (dep_id, _) in resolve.deps(pkg_id) {
let pkg = cargo_packages.get_one(dep_id)?;
let lib = pkg.targets().iter().find(|t| t.is_lib());
if let Some(lib) = lib {
let crate_name = resolve.extern_crate_name(&pkg_id, &dep_id, &lib)?;
packages[pkg_id_to_pkg[pkg_id].0].deps.push(Dep {
let crate_name = resolve.extern_crate_name(pkg_id, dep_id, &lib)?;
packages[pkg_id_to_pkg[&pkg_id].0].deps.push(Dep {
crate_name,
pkg: pkg_id_to_pkg[dep_id],
pkg: pkg_id_to_pkg[&dep_id],
})
}
}
Expand Down

0 comments on commit cfd8449

Please sign in to comment.