aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/mock_analysis.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-11-22 10:58:19 +0000
committerGitHub <[email protected]>2019-11-22 10:58:19 +0000
commitc866efdf36139502ec824bc38892fb2bda14484f (patch)
treed2d9cfb6f56cfe83b801d6e118e03051207f75a5 /crates/ra_ide_api/src/mock_analysis.rs
parent5be7bd605a09fafbc2bb91ebc3c4c3e35cf24110 (diff)
parent2c48fa087b6cc79ebfd81af9daf4a07d8019fd67 (diff)
Merge #2353
2353: Add support for environment to CrateGraph r=matklad a=matklad bors r+ Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/mock_analysis.rs')
-rw-r--r--crates/ra_ide_api/src/mock_analysis.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs
index 2b1c96dbf..bf8a54932 100644
--- a/crates/ra_ide_api/src/mock_analysis.rs
+++ b/crates/ra_ide_api/src/mock_analysis.rs
@@ -3,7 +3,7 @@
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use ra_cfg::CfgOptions; 5use ra_cfg::CfgOptions;
6use ra_db::RelativePathBuf; 6use ra_db::{Env, RelativePathBuf};
7use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; 7use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER};
8 8
9use crate::{ 9use crate::{
@@ -96,9 +96,15 @@ impl MockAnalysis {
96 let file_id = FileId(i as u32 + 1); 96 let file_id = FileId(i as u32 + 1);
97 let cfg_options = CfgOptions::default(); 97 let cfg_options = CfgOptions::default();
98 if path == "/lib.rs" || path == "/main.rs" { 98 if path == "/lib.rs" || path == "/main.rs" {
99 root_crate = Some(crate_graph.add_crate_root(file_id, Edition2018, cfg_options)); 99 root_crate = Some(crate_graph.add_crate_root(
100 file_id,
101 Edition2018,
102 cfg_options,
103 Env::default(),
104 ));
100 } else if path.ends_with("/lib.rs") { 105 } else if path.ends_with("/lib.rs") {
101 let other_crate = crate_graph.add_crate_root(file_id, Edition2018, cfg_options); 106 let other_crate =
107 crate_graph.add_crate_root(file_id, Edition2018, cfg_options, Env::default());
102 let crate_name = path.parent().unwrap().file_name().unwrap(); 108 let crate_name = path.parent().unwrap().file_name().unwrap();
103 if let Some(root_crate) = root_crate { 109 if let Some(root_crate) = root_crate {
104 crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); 110 crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap();