aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-06-30 21:15:37 +0100
committerGitHub <[email protected]>2020-06-30 21:15:37 +0100
commitc78180c318156d02e0b9454da67438ee96ad476d (patch)
tree5b84228ac444c9ef918ca21ff0ab5e01f9f77028 /crates
parentbad0b9aa23d2e72366922ec00d50043db0bae338 (diff)
parentcec92407f412b3c8e01d17eab84101a2b858e59e (diff)
Merge #5152
5152: Don't crash on empty out_dirs with older cargos r=matklad a=matklad closes #5125 bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 3b124020d..47a1d393d 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -1,6 +1,11 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use std::{ffi::OsStr, ops, path::Path, process::Command}; 3use std::{
4 ffi::OsStr,
5 ops,
6 path::{Path, PathBuf},
7 process::Command,
8};
4 9
5use anyhow::{Context, Result}; 10use anyhow::{Context, Result};
6use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; 11use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId};
@@ -308,9 +313,13 @@ pub fn load_extern_resources(
308 if let Ok(message) = message { 313 if let Ok(message) = message {
309 match message { 314 match message {
310 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { 315 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => {
311 let out_dir = AbsPathBuf::assert(out_dir); 316 // cargo_metadata crate returns default (empty) path for
312 res.out_dirs.insert(package_id.clone(), out_dir); 317 // older cargos, which is not absolute, so work around that.
313 res.cfgs.insert(package_id, cfgs); 318 if out_dir != PathBuf::default() {
319 let out_dir = AbsPathBuf::assert(out_dir);
320 res.out_dirs.insert(package_id.clone(), out_dir);
321 res.cfgs.insert(package_id, cfgs);
322 }
314 } 323 }
315 Message::CompilerArtifact(message) => { 324 Message::CompilerArtifact(message) => {
316 if message.target.kind.contains(&"proc-macro".to_string()) { 325 if message.target.kind.contains(&"proc-macro".to_string()) {