diff options
author | Aleksey Kladov <[email protected]> | 2019-11-22 10:55:03 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-11-22 10:57:25 +0000 |
commit | 2c48fa087b6cc79ebfd81af9daf4a07d8019fd67 (patch) | |
tree | d2d9cfb6f56cfe83b801d6e118e03051207f75a5 /crates/ra_project_model/src/lib.rs | |
parent | 5be7bd605a09fafbc2bb91ebc3c4c3e35cf24110 (diff) |
Add support for environment to CrateGraph
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 25 |
1 files changed, 19 insertions, 6 deletions
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::{ | |||
13 | }; | 13 | }; |
14 | 14 | ||
15 | use ra_cfg::CfgOptions; | 15 | use ra_cfg::CfgOptions; |
16 | use ra_db::{CrateGraph, CrateId, Edition, FileId}; | 16 | use ra_db::{CrateGraph, CrateId, Edition, Env, FileId}; |
17 | use rustc_hash::FxHashMap; | 17 | use rustc_hash::FxHashMap; |
18 | use serde_json::from_reader; | 18 | use serde_json::from_reader; |
19 | 19 | ||
@@ -146,7 +146,12 @@ impl ProjectWorkspace { | |||
146 | }; | 146 | }; |
147 | crates.insert( | 147 | crates.insert( |
148 | crate_id, | 148 | crate_id, |
149 | crate_graph.add_crate_root(file_id, edition, cfg_options), | 149 | crate_graph.add_crate_root( |
150 | file_id, | ||
151 | edition, | ||
152 | cfg_options, | ||
153 | Env::default(), | ||
154 | ), | ||
150 | ); | 155 | ); |
151 | } | 156 | } |
152 | } | 157 | } |
@@ -180,8 +185,12 @@ impl ProjectWorkspace { | |||
180 | opts | 185 | opts |
181 | }; | 186 | }; |
182 | 187 | ||
183 | let crate_id = | 188 | let crate_id = crate_graph.add_crate_root( |
184 | crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options); | 189 | file_id, |
190 | Edition::Edition2018, | ||
191 | cfg_options, | ||
192 | Env::default(), | ||
193 | ); | ||
185 | sysroot_crates.insert(krate, crate_id); | 194 | sysroot_crates.insert(krate, crate_id); |
186 | names.insert(crate_id, krate.name(&sysroot).to_string()); | 195 | names.insert(crate_id, krate.name(&sysroot).to_string()); |
187 | } | 196 | } |
@@ -216,8 +225,12 @@ impl ProjectWorkspace { | |||
216 | opts.insert_features(pkg.features(&cargo).iter().map(Into::into)); | 225 | opts.insert_features(pkg.features(&cargo).iter().map(Into::into)); |
217 | opts | 226 | opts |
218 | }; | 227 | }; |
219 | let crate_id = | 228 | let crate_id = crate_graph.add_crate_root( |
220 | crate_graph.add_crate_root(file_id, edition, cfg_options); | 229 | file_id, |
230 | edition, | ||
231 | cfg_options, | ||
232 | Env::default(), | ||
233 | ); | ||
221 | names.insert(crate_id, pkg.name(&cargo).to_string()); | 234 | names.insert(crate_id, pkg.name(&cargo).to_string()); |
222 | if tgt.kind(&cargo) == TargetKind::Lib { | 235 | if tgt.kind(&cargo) == TargetKind::Lib { |
223 | lib_tgt = Some(crate_id); | 236 | lib_tgt = Some(crate_id); |