diff options
Diffstat (limited to 'crates/ra_project_model/src/lib.rs')
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 43f834253..b2c3e576d 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -177,7 +177,6 @@ impl ProjectWorkspace { | |||
177 | pub fn to_crate_graph( | 177 | pub fn to_crate_graph( |
178 | &self, | 178 | &self, |
179 | default_cfg_options: &CfgOptions, | 179 | default_cfg_options: &CfgOptions, |
180 | additional_out_dirs: &FxHashMap<String, PathBuf>, | ||
181 | extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>, | 180 | extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>, |
182 | load: &mut dyn FnMut(&Path) -> Option<FileId>, | 181 | load: &mut dyn FnMut(&Path) -> Option<FileId>, |
183 | ) -> CrateGraph { | 182 | ) -> CrateGraph { |
@@ -251,15 +250,8 @@ impl ProjectWorkspace { | |||
251 | opts | 250 | opts |
252 | }; | 251 | }; |
253 | 252 | ||
254 | let mut env = Env::default(); | 253 | let env = Env::default(); |
255 | let mut extern_source = ExternSource::default(); | 254 | let extern_source = ExternSource::default(); |
256 | if let Some(path) = additional_out_dirs.get(krate.name(&sysroot)) { | ||
257 | env.set("OUT_DIR", path.to_string_lossy().to_string()); | ||
258 | if let Some(extern_source_id) = extern_source_roots.get(path) { | ||
259 | extern_source.set_extern_path(&path, *extern_source_id); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | let crate_id = crate_graph.add_crate_root( | 255 | let crate_id = crate_graph.add_crate_root( |
264 | file_id, | 256 | file_id, |
265 | Edition::Edition2018, | 257 | Edition::Edition2018, |
@@ -310,19 +302,11 @@ impl ProjectWorkspace { | |||
310 | }; | 302 | }; |
311 | let mut env = Env::default(); | 303 | let mut env = Env::default(); |
312 | let mut extern_source = ExternSource::default(); | 304 | let mut extern_source = ExternSource::default(); |
313 | if let Some(out_dir) = dbg!(pkg.out_dir(cargo)) { | 305 | if let Some(out_dir) = pkg.out_dir(cargo) { |
306 | // FIXME: We probably mangle non UTF-8 paths here, figure out a better solution | ||
314 | env.set("OUT_DIR", out_dir.to_string_lossy().to_string()); | 307 | env.set("OUT_DIR", out_dir.to_string_lossy().to_string()); |
315 | if let Some(extern_source_id) = | 308 | if let Some(&extern_source_id) = extern_source_roots.get(out_dir) { |
316 | dbg!(dbg!(&extern_source_roots).get(out_dir)) | 309 | extern_source.set_extern_path(&out_dir, extern_source_id); |
317 | { | ||
318 | extern_source.set_extern_path(&out_dir, *extern_source_id); | ||
319 | } | ||
320 | } else { | ||
321 | if let Some(path) = additional_out_dirs.get(pkg.name(&cargo)) { | ||
322 | env.set("OUT_DIR", path.to_string_lossy().to_string()); | ||
323 | if let Some(extern_source_id) = extern_source_roots.get(path) { | ||
324 | extern_source.set_extern_path(&path, *extern_source_id); | ||
325 | } | ||
326 | } | 310 | } |
327 | } | 311 | } |
328 | let crate_id = crate_graph.add_crate_root( | 312 | let crate_id = crate_graph.add_crate_root( |