From 2c48fa087b6cc79ebfd81af9daf4a07d8019fd67 Mon Sep 17 00:00:00 2001
From: Aleksey Kladov <aleksey.kladov@gmail.com>
Date: Fri, 22 Nov 2019 13:55:03 +0300
Subject: Add support for environment to CrateGraph

---
 crates/ra_project_model/src/lib.rs | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

(limited to 'crates/ra_project_model/src')

diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 0e14f1b70..d04a8cbe2 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -13,7 +13,7 @@ use std::{
 };
 
 use ra_cfg::CfgOptions;
-use ra_db::{CrateGraph, CrateId, Edition, FileId};
+use ra_db::{CrateGraph, CrateId, Edition, Env, FileId};
 use rustc_hash::FxHashMap;
 use serde_json::from_reader;
 
@@ -146,7 +146,12 @@ impl ProjectWorkspace {
                         };
                         crates.insert(
                             crate_id,
-                            crate_graph.add_crate_root(file_id, edition, cfg_options),
+                            crate_graph.add_crate_root(
+                                file_id,
+                                edition,
+                                cfg_options,
+                                Env::default(),
+                            ),
                         );
                     }
                 }
@@ -180,8 +185,12 @@ impl ProjectWorkspace {
                             opts
                         };
 
-                        let crate_id =
-                            crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options);
+                        let crate_id = crate_graph.add_crate_root(
+                            file_id,
+                            Edition::Edition2018,
+                            cfg_options,
+                            Env::default(),
+                        );
                         sysroot_crates.insert(krate, crate_id);
                         names.insert(crate_id, krate.name(&sysroot).to_string());
                     }
@@ -216,8 +225,12 @@ impl ProjectWorkspace {
                                 opts.insert_features(pkg.features(&cargo).iter().map(Into::into));
                                 opts
                             };
-                            let crate_id =
-                                crate_graph.add_crate_root(file_id, edition, cfg_options);
+                            let crate_id = crate_graph.add_crate_root(
+                                file_id,
+                                edition,
+                                cfg_options,
+                                Env::default(),
+                            );
                             names.insert(crate_id, pkg.name(&cargo).to_string());
                             if tgt.kind(&cargo) == TargetKind::Lib {
                                 lib_tgt = Some(crate_id);
-- 
cgit v1.2.3