aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs11
-rw-r--r--crates/ra_project_model/src/lib.rs8
2 files changed, 9 insertions, 10 deletions
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 {
83 pub dependencies: Vec<PackageDependency>, 83 pub dependencies: Vec<PackageDependency>,
84 pub edition: Edition, 84 pub edition: Edition,
85 pub features: Vec<String>, 85 pub features: Vec<String>,
86 pub cfgs: Vec<PathBuf>, 86 pub cfgs: Vec<String>,
87 pub out_dir: Option<PathBuf>, 87 pub out_dir: Option<PathBuf>,
88 pub proc_macro_dylib_path: Option<PathBuf>, 88 pub proc_macro_dylib_path: Option<PathBuf>,
89} 89}
@@ -279,7 +279,7 @@ impl CargoWorkspace {
279pub struct ExternResources { 279pub struct ExternResources {
280 out_dirs: FxHashMap<PackageId, PathBuf>, 280 out_dirs: FxHashMap<PackageId, PathBuf>,
281 proc_dylib_paths: FxHashMap<PackageId, PathBuf>, 281 proc_dylib_paths: FxHashMap<PackageId, PathBuf>,
282 cfgs: FxHashMap<PackageId, Vec<PathBuf>>, 282 cfgs: FxHashMap<PackageId, Vec<String>>,
283} 283}
284 284
285pub fn load_extern_resources( 285pub fn load_extern_resources(
@@ -307,7 +307,12 @@ pub fn load_extern_resources(
307 match message { 307 match message {
308 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => { 308 Message::BuildScriptExecuted(BuildScript { package_id, out_dir, cfgs, .. }) => {
309 res.out_dirs.insert(package_id.clone(), out_dir); 309 res.out_dirs.insert(package_id.clone(), out_dir);
310 res.cfgs.insert(package_id, cfgs); 310 res.cfgs.insert(
311 package_id,
312 // FIXME: Current `cargo_metadata` uses `PathBuf` instead of `String`,
313 // change when https://github.com/oli-obk/cargo_metadata/pulls/112 reaches crates.io
314 cfgs.iter().filter_map(|c| c.to_str().map(|s| s.to_owned())).collect(),
315 );
311 } 316 }
312 317
313 Message::CompilerArtifact(message) => { 318 Message::CompilerArtifact(message) => {
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 2d5d61b61..7231da221 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -399,13 +399,7 @@ impl ProjectWorkspace {
399 let cfg_options = { 399 let cfg_options = {
400 let mut opts = default_cfg_options.clone(); 400 let mut opts = default_cfg_options.clone();
401 opts.insert_features(cargo[pkg].features.iter().map(Into::into)); 401 opts.insert_features(cargo[pkg].features.iter().map(Into::into));
402 opts.insert_cfgs( 402 opts.insert_cfgs(cargo[pkg].cfgs.iter().map(Into::into));
403 cargo[pkg]
404 .cfgs
405 .iter()
406 .filter_map(|c| c.to_str())
407 .map(Into::into),
408 );
409 opts 403 opts
410 }; 404 };
411 let mut env = Env::default(); 405 let mut env = Env::default();