aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r--crates/ra_ide/src/lib.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs
index 4dfe0553e..c60e86aea 100644
--- a/crates/ra_ide/src/lib.rs
+++ b/crates/ra_ide/src/lib.rs
@@ -211,7 +211,13 @@ impl Analysis {
211 // Default to enable test for single file. 211 // Default to enable test for single file.
212 let mut cfg_options = CfgOptions::default(); 212 let mut cfg_options = CfgOptions::default();
213 cfg_options.insert_atom("test".into()); 213 cfg_options.insert_atom("test".into());
214 crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options, Env::default()); 214 crate_graph.add_crate_root(
215 file_id,
216 Edition::Edition2018,
217 None,
218 cfg_options,
219 Env::default(),
220 );
215 change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text)); 221 change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text));
216 change.set_crate_graph(crate_graph); 222 change.set_crate_graph(crate_graph);
217 host.apply_change(change); 223 host.apply_change(change);
@@ -415,12 +421,12 @@ impl Analysis {
415 421
416 /// Returns the edition of the given crate. 422 /// Returns the edition of the given crate.
417 pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> { 423 pub fn crate_edition(&self, crate_id: CrateId) -> Cancelable<Edition> {
418 self.with_db(|db| db.crate_graph().edition(crate_id)) 424 self.with_db(|db| db.crate_graph()[crate_id].edition)
419 } 425 }
420 426
421 /// Returns the root file of the given crate. 427 /// Returns the root file of the given crate.
422 pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> { 428 pub fn crate_root(&self, crate_id: CrateId) -> Cancelable<FileId> {
423 self.with_db(|db| db.crate_graph().crate_root(crate_id)) 429 self.with_db(|db| db.crate_graph()[crate_id].root_file_id)
424 } 430 }
425 431
426 /// Returns the set of possible targets to run for the current file. 432 /// Returns the set of possible targets to run for the current file.