aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_db/src/fixture.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_db/src/fixture.rs')
-rw-r--r--crates/ra_db/src/fixture.rs19
1 files changed, 15 insertions, 4 deletions
diff --git a/crates/ra_db/src/fixture.rs b/crates/ra_db/src/fixture.rs
index ade187629..e8f335e33 100644
--- a/crates/ra_db/src/fixture.rs
+++ b/crates/ra_db/src/fixture.rs
@@ -8,7 +8,7 @@ use rustc_hash::FxHashMap;
8use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER}; 8use test_utils::{extract_offset, parse_fixture, CURSOR_MARKER};
9 9
10use crate::{ 10use crate::{
11 CrateGraph, CrateId, Edition, FileId, FilePosition, RelativePathBuf, SourceDatabaseExt, 11 CrateGraph, CrateId, Edition, Env, FileId, FilePosition, RelativePathBuf, SourceDatabaseExt,
12 SourceRoot, SourceRootId, 12 SourceRoot, SourceRootId,
13}; 13};
14 14
@@ -53,7 +53,12 @@ fn with_single_file(db: &mut dyn SourceDatabaseExt, text: &str) -> FileId {
53 source_root.insert_file(rel_path.clone(), file_id); 53 source_root.insert_file(rel_path.clone(), file_id);
54 54
55 let mut crate_graph = CrateGraph::default(); 55 let mut crate_graph = CrateGraph::default();
56 crate_graph.add_crate_root(file_id, Edition::Edition2018, CfgOptions::default()); 56 crate_graph.add_crate_root(
57 file_id,
58 Edition::Edition2018,
59 CfgOptions::default(),
60 Env::default(),
61 );
57 62
58 db.set_file_text(file_id, Arc::new(text.to_string())); 63 db.set_file_text(file_id, Arc::new(text.to_string()));
59 db.set_file_relative_path(file_id, rel_path); 64 db.set_file_relative_path(file_id, rel_path);
@@ -93,7 +98,8 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit
93 assert!(meta.path.starts_with(&source_root_prefix)); 98 assert!(meta.path.starts_with(&source_root_prefix));
94 99
95 if let Some(krate) = meta.krate { 100 if let Some(krate) = meta.krate {
96 let crate_id = crate_graph.add_crate_root(file_id, meta.edition, meta.cfg); 101 let crate_id =
102 crate_graph.add_crate_root(file_id, meta.edition, meta.cfg, Env::default());
97 let prev = crates.insert(krate.clone(), crate_id); 103 let prev = crates.insert(krate.clone(), crate_id);
98 assert!(prev.is_none()); 104 assert!(prev.is_none());
99 for dep in meta.deps { 105 for dep in meta.deps {
@@ -123,7 +129,12 @@ fn with_files(db: &mut dyn SourceDatabaseExt, fixture: &str) -> Option<FilePosit
123 129
124 if crates.is_empty() { 130 if crates.is_empty() {
125 let crate_root = default_crate_root.unwrap(); 131 let crate_root = default_crate_root.unwrap();
126 crate_graph.add_crate_root(crate_root, Edition::Edition2018, CfgOptions::default()); 132 crate_graph.add_crate_root(
133 crate_root,
134 Edition::Edition2018,
135 CfgOptions::default(),
136 Env::default(),
137 );
127 } else { 138 } else {
128 for (from, to) in crate_deps { 139 for (from, to) in crate_deps {
129 let from_id = crates[&from]; 140 let from_id = crates[&from];