aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/mock_analysis.rs
diff options
context:
space:
mode:
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();