aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/Cargo.toml2
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs14
2 files changed, 6 insertions, 10 deletions
diff --git a/crates/ra_project_model/Cargo.toml b/crates/ra_project_model/Cargo.toml
index a32a5daab..e4a60f4c0 100644
--- a/crates/ra_project_model/Cargo.toml
+++ b/crates/ra_project_model/Cargo.toml
@@ -11,7 +11,7 @@ doctest = false
11log = "0.4.8" 11log = "0.4.8"
12rustc-hash = "1.1.0" 12rustc-hash = "1.1.0"
13 13
14cargo_metadata = "0.9.1" 14cargo_metadata = "0.10.0"
15 15
16ra_arena = { path = "../ra_arena" } 16ra_arena = { path = "../ra_arena" }
17ra_cfg = { path = "../ra_cfg" } 17ra_cfg = { path = "../ra_cfg" }
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 082af4f96..a306ce95f 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -161,7 +161,7 @@ impl CargoWorkspace {
161 meta.current_dir(parent); 161 meta.current_dir(parent);
162 } 162 }
163 if let Some(target) = cargo_features.target.as_ref() { 163 if let Some(target) = cargo_features.target.as_ref() {
164 meta.other_options(&[String::from("--filter-platform"), target.clone()]); 164 meta.other_options(vec![String::from("--filter-platform"), target.clone()]);
165 } 165 }
166 let meta = meta.exec().with_context(|| { 166 let meta = meta.exec().with_context(|| {
167 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display()) 167 format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display())
@@ -304,19 +304,13 @@ pub fn load_extern_resources(
304 304
305 let mut res = ExternResources::default(); 305 let mut res = ExternResources::default();
306 306
307 for message in cargo_metadata::parse_messages(output.stdout.as_slice()) { 307 for message in cargo_metadata::Message::parse_stream(output.stdout.as_slice()) {
308 if let Ok(message) = message { 308 if let Ok(message) = message {
309 match message { 309 match message {
310 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { 310 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => {
311 res.out_dirs.insert(package_id.clone(), out_dir); 311 res.out_dirs.insert(package_id.clone(), out_dir);
312 res.cfgs.insert( 312 res.cfgs.insert(package_id, cfgs);
313 package_id,
314 // FIXME: Current `cargo_metadata` uses `PathBuf` instead of `String`,
315 // change when https://github.com/oli-obk/cargo_metadata/pulls/112 reaches crates.io
316 cfgs.iter().filter_map(|c| c.to_str().map(|s| s.to_owned())).collect(),
317 );
318 } 313 }
319
320 Message::CompilerArtifact(message) => { 314 Message::CompilerArtifact(message) => {
321 if message.target.kind.contains(&"proc-macro".to_string()) { 315 if message.target.kind.contains(&"proc-macro".to_string()) {
322 let package_id = message.package_id; 316 let package_id = message.package_id;
@@ -329,6 +323,8 @@ pub fn load_extern_resources(
329 } 323 }
330 Message::CompilerMessage(_) => (), 324 Message::CompilerMessage(_) => (),
331 Message::Unknown => (), 325 Message::Unknown => (),
326 Message::BuildFinished(_) => {}
327 Message::TextLine(_) => {}
332 } 328 }
333 } 329 }
334 } 330 }