From b7edffe244581b428a4b4da4ff6a08ab461b018f Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Mon, 27 Apr 2020 00:11:04 +0200 Subject: Started rust-analyzer.cargo.defaultTarget implementation --- crates/ra_project_model/src/cargo_workspace.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 362ee30fe..810833b64 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -42,6 +42,11 @@ impl ops::Index for CargoWorkspace { } } +#[derive(Clone, Debug, PartialEq, Eq)] +pub struct RustcConfig { + pub default_target: Option, +} + #[derive(Clone, Debug, PartialEq, Eq)] pub struct CargoConfig { /// Do not activate the `default` feature. @@ -56,6 +61,9 @@ pub struct CargoConfig { /// Runs cargo check on launch to figure out the correct values of OUT_DIR pub load_out_dirs_from_check: bool, + + /// rustc config + pub rustc: RustcConfig, } impl Default for CargoConfig { @@ -65,6 +73,7 @@ impl Default for CargoConfig { all_features: true, features: Vec::new(), load_out_dirs_from_check: false, + rustc: RustcConfig { default_target: None }, } } } @@ -160,6 +169,9 @@ impl CargoWorkspace { if let Some(parent) = cargo_toml.parent() { meta.current_dir(parent); } + if let Some(target) = cargo_features.rustc.default_target.as_ref() { + meta.other_options(&[String::from("--filter-platform"), target.clone()]); + } let meta = meta.exec().with_context(|| { format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display()) })?; -- cgit v1.2.3 From ed5af989f431b9bfabf6f67350587add05a1942c Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 28 Apr 2020 00:15:54 +0200 Subject: [config] rename cargo.defaultTarget --- crates/ra_project_model/src/cargo_workspace.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 810833b64..1dfee6b47 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -62,8 +62,8 @@ pub struct CargoConfig { /// Runs cargo check on launch to figure out the correct values of OUT_DIR pub load_out_dirs_from_check: bool, - /// rustc config - pub rustc: RustcConfig, + /// rustc target + pub default_target: Option, } impl Default for CargoConfig { @@ -73,7 +73,7 @@ impl Default for CargoConfig { all_features: true, features: Vec::new(), load_out_dirs_from_check: false, - rustc: RustcConfig { default_target: None }, + default_target: None, } } } @@ -169,7 +169,7 @@ impl CargoWorkspace { if let Some(parent) = cargo_toml.parent() { meta.current_dir(parent); } - if let Some(target) = cargo_features.rustc.default_target.as_ref() { + if let Some(target) = cargo_features.default_target.as_ref() { meta.other_options(&[String::from("--filter-platform"), target.clone()]); } let meta = meta.exec().with_context(|| { -- cgit v1.2.3 From e7523511ce201763e093d5f5563c20d0e0fc5d54 Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 28 Apr 2020 00:17:23 +0200 Subject: [config] remove RustcConfig --- crates/ra_project_model/src/cargo_workspace.rs | 5 ----- 1 file changed, 5 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 1dfee6b47..31499b468 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -42,11 +42,6 @@ impl ops::Index for CargoWorkspace { } } -#[derive(Clone, Debug, PartialEq, Eq)] -pub struct RustcConfig { - pub default_target: Option, -} - #[derive(Clone, Debug, PartialEq, Eq)] pub struct CargoConfig { /// Do not activate the `default` feature. -- cgit v1.2.3 From 2980ba1fde50a6fc8863750b9dd7f09e3c1227ce Mon Sep 17 00:00:00 2001 From: robojumper Date: Mon, 4 May 2020 13:29:09 +0200 Subject: Support build.rs cargo:rustc-cfg --- crates/ra_project_model/src/cargo_workspace.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 362ee30fe..afbd30164 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -83,6 +83,7 @@ pub struct PackageData { pub dependencies: Vec, pub edition: Edition, pub features: Vec, + pub cfgs: Vec, pub out_dir: Option, pub proc_macro_dylib_path: Option, } @@ -165,10 +166,12 @@ impl CargoWorkspace { })?; let mut out_dir_by_id = FxHashMap::default(); + let mut cfgs = FxHashMap::default(); let mut proc_macro_dylib_paths = FxHashMap::default(); if cargo_features.load_out_dirs_from_check { let resources = load_extern_resources(cargo_toml, cargo_features)?; out_dir_by_id = resources.out_dirs; + cfgs = resources.cfgs; proc_macro_dylib_paths = resources.proc_dylib_paths; } @@ -194,6 +197,7 @@ impl CargoWorkspace { edition, dependencies: Vec::new(), features: Vec::new(), + cfgs: cfgs.get(&id).cloned().unwrap_or_default(), out_dir: out_dir_by_id.get(&id).cloned(), proc_macro_dylib_path: proc_macro_dylib_paths.get(&id).cloned(), }); @@ -275,6 +279,7 @@ impl CargoWorkspace { pub struct ExternResources { out_dirs: FxHashMap, proc_dylib_paths: FxHashMap, + cfgs: FxHashMap>, } pub fn load_extern_resources( @@ -300,8 +305,9 @@ pub fn load_extern_resources( for message in cargo_metadata::parse_messages(output.stdout.as_slice()) { if let Ok(message) = message { match message { - Message::BuildScriptExecuted(BuildScript { package_id, out_dir, .. }) => { - res.out_dirs.insert(package_id, out_dir); + Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { + res.out_dirs.insert(package_id.clone(), out_dir); + res.cfgs.insert(package_id, cfgs); } Message::CompilerArtifact(message) => { -- cgit v1.2.3 From f2dd233ddc60b647fe9c32ea2d712224005ae99e Mon Sep 17 00:00:00 2001 From: robojumper Date: Tue, 5 May 2020 14:53:52 +0200 Subject: Assume cargo_metadata uses String for cfgs soon --- crates/ra_project_model/src/cargo_workspace.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index afbd30164..bf83adc42 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -83,7 +83,7 @@ pub struct PackageData { pub dependencies: Vec, pub edition: Edition, pub features: Vec, - pub cfgs: Vec, + pub cfgs: Vec, pub out_dir: Option, pub proc_macro_dylib_path: Option, } @@ -279,7 +279,7 @@ impl CargoWorkspace { pub struct ExternResources { out_dirs: FxHashMap, proc_dylib_paths: FxHashMap, - cfgs: FxHashMap>, + cfgs: FxHashMap>, } pub fn load_extern_resources( @@ -307,7 +307,12 @@ pub fn load_extern_resources( match message { Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { res.out_dirs.insert(package_id.clone(), out_dir); - res.cfgs.insert(package_id, cfgs); + res.cfgs.insert( + package_id, + // FIXME: Current `cargo_metadata` uses `PathBuf` instead of `String`, + // change when https://github.com/oli-obk/cargo_metadata/pulls/112 reaches crates.io + cfgs.iter().filter_map(|c| c.to_str().map(|s| s.to_owned())).collect(), + ); } Message::CompilerArtifact(message) => { -- cgit v1.2.3 From 0ab4340cdb31ac4d50f039f0a56ebaff86710eb7 Mon Sep 17 00:00:00 2001 From: Christophe MASSOLIN Date: Tue, 5 May 2020 18:01:54 +0200 Subject: Rename `defaultTarget` to target --- crates/ra_project_model/src/cargo_workspace.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 31499b468..59f46a2a0 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -58,7 +58,7 @@ pub struct CargoConfig { pub load_out_dirs_from_check: bool, /// rustc target - pub default_target: Option, + pub target: Option, } impl Default for CargoConfig { @@ -68,7 +68,7 @@ impl Default for CargoConfig { all_features: true, features: Vec::new(), load_out_dirs_from_check: false, - default_target: None, + target: None, } } } @@ -164,7 +164,7 @@ impl CargoWorkspace { if let Some(parent) = cargo_toml.parent() { meta.current_dir(parent); } - if let Some(target) = cargo_features.default_target.as_ref() { + if let Some(target) = cargo_features.target.as_ref() { meta.other_options(&[String::from("--filter-platform"), target.clone()]); } let meta = meta.exec().with_context(|| { -- cgit v1.2.3 From ffaef1b7aeb61984992e231d9af20f39486403ea Mon Sep 17 00:00:00 2001 From: Craig Disselkoen Date: Tue, 5 May 2020 11:59:41 -0700 Subject: ra_project_model: look for Cargo in more places See #3118 --- crates/ra_project_model/src/cargo_workspace.rs | 59 ++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 9 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 59f46a2a0..a15a8c68e 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -8,7 +8,7 @@ use std::{ process::Command, }; -use anyhow::{Context, Result}; +use anyhow::{Context, Error, Result}; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; use ra_arena::{Arena, Idx}; use ra_db::Edition; @@ -145,12 +145,8 @@ impl CargoWorkspace { cargo_toml: &Path, cargo_features: &CargoConfig, ) -> Result { - let _ = Command::new(cargo_binary()) - .arg("--version") - .output() - .context("failed to run `cargo --version`, is `cargo` in PATH?")?; - let mut meta = MetadataCommand::new(); + meta.cargo_path(cargo_binary()?); meta.manifest_path(cargo_toml); if cargo_features.all_features { meta.features(CargoOpt::AllFeatures); @@ -288,7 +284,7 @@ pub fn load_extern_resources( cargo_toml: &Path, cargo_features: &CargoConfig, ) -> Result { - let mut cmd = Command::new(cargo_binary()); + let mut cmd = Command::new(cargo_binary()?); cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); if cargo_features.all_features { cmd.arg("--all-features"); @@ -337,6 +333,51 @@ fn is_dylib(path: &Path) -> bool { } } -fn cargo_binary() -> String { - env::var("CARGO").unwrap_or_else(|_| "cargo".to_string()) +/// Return a `String` to use for executable `cargo`. +/// +/// E.g., this may just be `cargo` if that gives a valid Cargo executable; or it +/// may be a full path to a valid Cargo. +fn cargo_binary() -> Result { + // The current implementation checks three places for a `cargo` to use: + // 1) $CARGO environment variable (erroring if this is set but not a usable Cargo) + // 2) `cargo` + // 3) `~/.cargo/bin/cargo` + if let Ok(path) = env::var("CARGO") { + if is_valid_cargo(&path) { + Ok(path) + } else { + Err(Error::msg("`CARGO` environment variable points to something that's not a valid Cargo executable")) + } + } else { + let final_path: Option = if is_valid_cargo("cargo") { + Some("cargo".to_owned()) + } else { + if let Some(mut path) = dirs::home_dir() { + path.push(".cargo"); + path.push("bin"); + path.push("cargo"); + if is_valid_cargo(&path) { + Some(path.into_os_string().into_string().expect("Invalid Unicode in path")) + } else { + None + } + } else { + None + } + }; + final_path.ok_or( + // This error message may also be caused by $PATH or $CARGO not being set correctly for VSCode, + // even if they are set correctly in a terminal. + // On macOS in particular, launching VSCode from terminal with `code ` causes VSCode + // to inherit environment variables including $PATH and $CARGO from that terminal; but + // launching VSCode from Dock does not inherit environment variables from a terminal. + // For more discussion, see #3118. + Error::msg("Failed to find `cargo` executable. Make sure `cargo` is in `$PATH`, or set `$CARGO` to point to a valid Cargo executable.") + ) + } +} + +/// Does the given `Path` point to a usable `Cargo`? +fn is_valid_cargo(p: impl AsRef) -> bool { + Command::new(p.as_ref()).arg("--version").output().is_ok() } -- cgit v1.2.3 From 5aa1bba107ef434e61c3136120b9478a307d67a9 Mon Sep 17 00:00:00 2001 From: Craig Disselkoen Date: Tue, 5 May 2020 13:44:43 -0700 Subject: more generic, find rustc as well --- crates/ra_project_model/src/cargo_workspace.rs | 57 ++------------------------ 1 file changed, 4 insertions(+), 53 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index a15a8c68e..c7350d1e0 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -1,14 +1,14 @@ //! FIXME: write short doc here use std::{ - env, ffi::OsStr, ops, path::{Path, PathBuf}, process::Command, }; -use anyhow::{Context, Error, Result}; +use super::find_executables::get_path_for_executable; +use anyhow::{Context, Result}; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; use ra_arena::{Arena, Idx}; use ra_db::Edition; @@ -146,7 +146,7 @@ impl CargoWorkspace { cargo_features: &CargoConfig, ) -> Result { let mut meta = MetadataCommand::new(); - meta.cargo_path(cargo_binary()?); + meta.cargo_path(get_path_for_executable("cargo")?); meta.manifest_path(cargo_toml); if cargo_features.all_features { meta.features(CargoOpt::AllFeatures); @@ -284,7 +284,7 @@ pub fn load_extern_resources( cargo_toml: &Path, cargo_features: &CargoConfig, ) -> Result { - let mut cmd = Command::new(cargo_binary()?); + let mut cmd = Command::new(get_path_for_executable("cargo")?); cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); if cargo_features.all_features { cmd.arg("--all-features"); @@ -332,52 +332,3 @@ fn is_dylib(path: &Path) -> bool { Some(ext) => matches!(ext.as_str(), "dll" | "dylib" | "so"), } } - -/// Return a `String` to use for executable `cargo`. -/// -/// E.g., this may just be `cargo` if that gives a valid Cargo executable; or it -/// may be a full path to a valid Cargo. -fn cargo_binary() -> Result { - // The current implementation checks three places for a `cargo` to use: - // 1) $CARGO environment variable (erroring if this is set but not a usable Cargo) - // 2) `cargo` - // 3) `~/.cargo/bin/cargo` - if let Ok(path) = env::var("CARGO") { - if is_valid_cargo(&path) { - Ok(path) - } else { - Err(Error::msg("`CARGO` environment variable points to something that's not a valid Cargo executable")) - } - } else { - let final_path: Option = if is_valid_cargo("cargo") { - Some("cargo".to_owned()) - } else { - if let Some(mut path) = dirs::home_dir() { - path.push(".cargo"); - path.push("bin"); - path.push("cargo"); - if is_valid_cargo(&path) { - Some(path.into_os_string().into_string().expect("Invalid Unicode in path")) - } else { - None - } - } else { - None - } - }; - final_path.ok_or( - // This error message may also be caused by $PATH or $CARGO not being set correctly for VSCode, - // even if they are set correctly in a terminal. - // On macOS in particular, launching VSCode from terminal with `code ` causes VSCode - // to inherit environment variables including $PATH and $CARGO from that terminal; but - // launching VSCode from Dock does not inherit environment variables from a terminal. - // For more discussion, see #3118. - Error::msg("Failed to find `cargo` executable. Make sure `cargo` is in `$PATH`, or set `$CARGO` to point to a valid Cargo executable.") - ) - } -} - -/// Does the given `Path` point to a usable `Cargo`? -fn is_valid_cargo(p: impl AsRef) -> bool { - Command::new(p.as_ref()).arg("--version").output().is_ok() -} -- cgit v1.2.3 From 303b444dbb66019fc916dd350e54f7675aa3007f Mon Sep 17 00:00:00 2001 From: Craig Disselkoen Date: Tue, 5 May 2020 14:07:10 -0700 Subject: pull function out into new crate ra_env; use in ra_flycheck as well --- crates/ra_project_model/src/cargo_workspace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index c7350d1e0..4027f020f 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -7,11 +7,11 @@ use std::{ process::Command, }; -use super::find_executables::get_path_for_executable; use anyhow::{Context, Result}; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; use ra_arena::{Arena, Idx}; use ra_db::Edition; +use ra_env::get_path_for_executable; use rustc_hash::FxHashMap; /// `CargoWorkspace` represents the logical structure of, well, a Cargo -- cgit v1.2.3 From 6713be0b130670324c61d9deb38b7b6aee6a8bac Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 May 2020 12:25:36 +0200 Subject: Rename ra_env -> ra_toolchain --- crates/ra_project_model/src/cargo_workspace.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index eb9f33ee8..9683bfcc0 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -11,7 +11,7 @@ use anyhow::{Context, Result}; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; use ra_arena::{Arena, Idx}; use ra_db::Edition; -use ra_env::get_path_for_executable; +use ra_toolchain::get_path_for_executable; use rustc_hash::FxHashMap; /// `CargoWorkspace` represents the logical structure of, well, a Cargo -- cgit v1.2.3 From ecff5dc141046c5b9e40639657247a05fb9b0344 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 8 May 2020 14:54:29 +0200 Subject: Cleanup --- crates/ra_project_model/src/cargo_workspace.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index 9683bfcc0..082af4f96 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -11,7 +11,6 @@ use anyhow::{Context, Result}; use cargo_metadata::{BuildScript, CargoOpt, Message, MetadataCommand, PackageId}; use ra_arena::{Arena, Idx}; use ra_db::Edition; -use ra_toolchain::get_path_for_executable; use rustc_hash::FxHashMap; /// `CargoWorkspace` represents the logical structure of, well, a Cargo @@ -147,7 +146,7 @@ impl CargoWorkspace { cargo_features: &CargoConfig, ) -> Result { let mut meta = MetadataCommand::new(); - meta.cargo_path(get_path_for_executable("cargo")?); + meta.cargo_path(ra_toolchain::cargo()); meta.manifest_path(cargo_toml); if cargo_features.all_features { meta.features(CargoOpt::AllFeatures); @@ -289,7 +288,7 @@ pub fn load_extern_resources( cargo_toml: &Path, cargo_features: &CargoConfig, ) -> Result { - let mut cmd = Command::new(get_path_for_executable("cargo")?); + let mut cmd = Command::new(ra_toolchain::cargo()); cmd.args(&["check", "--message-format=json", "--manifest-path"]).arg(cargo_toml); if cargo_features.all_features { cmd.arg("--all-features"); -- cgit v1.2.3 From 2400d70442364769b4ae18315fc178427d2d95a9 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Sun, 10 May 2020 06:22:26 +0800 Subject: Update cargo-metadata --- crates/ra_project_model/src/cargo_workspace.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'crates/ra_project_model/src/cargo_workspace.rs') diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs index eb9f33ee8..9152a6d9d 100644 --- a/crates/ra_project_model/src/cargo_workspace.rs +++ b/crates/ra_project_model/src/cargo_workspace.rs @@ -162,7 +162,7 @@ impl CargoWorkspace { meta.current_dir(parent); } if let Some(target) = cargo_features.target.as_ref() { - meta.other_options(&[String::from("--filter-platform"), target.clone()]); + meta.other_options(vec![String::from("--filter-platform"), target.clone()]); } let meta = meta.exec().with_context(|| { format!("Failed to run `cargo metadata --manifest-path {}`", cargo_toml.display()) @@ -305,19 +305,13 @@ pub fn load_extern_resources( let mut res = ExternResources::default(); - for message in cargo_metadata::parse_messages(output.stdout.as_slice()) { + for message in cargo_metadata::Message::parse_stream(output.stdout.as_slice()) { if let Ok(message) = message { match message { Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { res.out_dirs.insert(package_id.clone(), out_dir); - res.cfgs.insert( - package_id, - // FIXME: Current `cargo_metadata` uses `PathBuf` instead of `String`, - // change when https://github.com/oli-obk/cargo_metadata/pulls/112 reaches crates.io - cfgs.iter().filter_map(|c| c.to_str().map(|s| s.to_owned())).collect(), - ); + res.cfgs.insert(package_id, cfgs); } - Message::CompilerArtifact(message) => { if message.target.kind.contains(&"proc-macro".to_string()) { let package_id = message.package_id; @@ -330,6 +324,8 @@ pub fn load_extern_resources( } Message::CompilerMessage(_) => (), Message::Unknown => (), + Message::BuildFinished(_) => {} + Message::TextLine(_) => {} } } } -- cgit v1.2.3