diff options
Diffstat (limited to 'crates/ra_ide_api/src/mock_analysis.rs')
-rw-r--r-- | crates/ra_ide_api/src/mock_analysis.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/ra_ide_api/src/mock_analysis.rs b/crates/ra_ide_api/src/mock_analysis.rs index 16870c7ae..80b71894c 100644 --- a/crates/ra_ide_api/src/mock_analysis.rs +++ b/crates/ra_ide_api/src/mock_analysis.rs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use ra_cfg::CfgOptions; | ||
5 | use relative_path::RelativePathBuf; | 6 | use relative_path::RelativePathBuf; |
6 | use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; | 7 | use test_utils::{extract_offset, extract_range, parse_fixture, CURSOR_MARKER}; |
7 | 8 | ||
@@ -93,10 +94,11 @@ impl MockAnalysis { | |||
93 | assert!(path.starts_with('/')); | 94 | assert!(path.starts_with('/')); |
94 | let path = RelativePathBuf::from_path(&path[1..]).unwrap(); | 95 | let path = RelativePathBuf::from_path(&path[1..]).unwrap(); |
95 | let file_id = FileId(i as u32 + 1); | 96 | let file_id = FileId(i as u32 + 1); |
97 | let cfg_options = CfgOptions::default(); | ||
96 | if path == "/lib.rs" || path == "/main.rs" { | 98 | if path == "/lib.rs" || path == "/main.rs" { |
97 | root_crate = Some(crate_graph.add_crate_root(file_id, Edition2018)); | 99 | root_crate = Some(crate_graph.add_crate_root(file_id, Edition2018, cfg_options)); |
98 | } else if path.ends_with("/lib.rs") { | 100 | } else if path.ends_with("/lib.rs") { |
99 | let other_crate = crate_graph.add_crate_root(file_id, Edition2018); | 101 | let other_crate = crate_graph.add_crate_root(file_id, Edition2018, cfg_options); |
100 | let crate_name = path.parent().unwrap().file_name().unwrap(); | 102 | let crate_name = path.parent().unwrap().file_name().unwrap(); |
101 | if let Some(root_crate) = root_crate { | 103 | if let Some(root_crate) = root_crate { |
102 | crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); | 104 | crate_graph.add_dep(root_crate, crate_name.into(), other_crate).unwrap(); |