aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_def/src/nameres
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_def/src/nameres')
-rw-r--r--crates/ra_hir_def/src/nameres/collector.rs20
1 files changed, 10 insertions, 10 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs
index 8a96d3d31..0bc36910c 100644
--- a/crates/ra_hir_def/src/nameres/collector.rs
+++ b/crates/ra_hir_def/src/nameres/collector.rs
@@ -739,17 +739,18 @@ fn is_macro_rules(path: &Path) -> bool {
739 path.as_ident() == Some(&name::MACRO_RULES) 739 path.as_ident() == Some(&name::MACRO_RULES)
740} 740}
741 741
742#[cfg(never)] 742#[cfg(test)]
743mod tests { 743mod tests {
744 use ra_db::SourceDatabase;
745
746 use super::*;
747 use crate::{db::DefDatabase, mock::MockDatabase, Crate};
748 use ra_arena::Arena; 744 use ra_arena::Arena;
745 use ra_db::{fixture::WithFixture, SourceDatabase};
749 use rustc_hash::FxHashSet; 746 use rustc_hash::FxHashSet;
750 747
748 use crate::{db::DefDatabase2, test_db::TestDB};
749
750 use super::*;
751
751 fn do_collect_defs( 752 fn do_collect_defs(
752 db: &impl DefDatabase, 753 db: &impl DefDatabase2,
753 def_map: CrateDefMap, 754 def_map: CrateDefMap,
754 monitor: MacroStackMonitor, 755 monitor: MacroStackMonitor,
755 ) -> CrateDefMap { 756 ) -> CrateDefMap {
@@ -768,12 +769,11 @@ mod tests {
768 } 769 }
769 770
770 fn do_limited_resolve(code: &str, limit: u32, poison_limit: u32) -> CrateDefMap { 771 fn do_limited_resolve(code: &str, limit: u32, poison_limit: u32) -> CrateDefMap {
771 let (db, _source_root, _) = MockDatabase::with_single_file(&code); 772 let (db, _file_id) = TestDB::with_single_file(&code);
772 let crate_id = db.crate_graph().iter().next().unwrap(); 773 let krate = db.crate_graph().iter().next().unwrap();
773 let krate = Crate { crate_id };
774 774
775 let def_map = { 775 let def_map = {
776 let edition = krate.edition(&db); 776 let edition = db.crate_graph().edition(krate);
777 let mut modules: Arena<CrateModuleId, ModuleData> = Arena::default(); 777 let mut modules: Arena<CrateModuleId, ModuleData> = Arena::default();
778 let root = modules.alloc(ModuleData::default()); 778 let root = modules.alloc(ModuleData::default());
779 CrateDefMap { 779 CrateDefMap {