aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r--crates/ra_hir_ty/src/test_db.rs4
-rw-r--r--crates/ra_hir_ty/src/tests.rs10
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_hir_ty/src/test_db.rs b/crates/ra_hir_ty/src/test_db.rs
index 874357008..1dc9793f9 100644
--- a/crates/ra_hir_ty/src/test_db.rs
+++ b/crates/ra_hir_ty/src/test_db.rs
@@ -73,9 +73,9 @@ impl TestDB {
73 pub fn module_for_file(&self, file_id: FileId) -> ModuleId { 73 pub fn module_for_file(&self, file_id: FileId) -> ModuleId {
74 for &krate in self.relevant_crates(file_id).iter() { 74 for &krate in self.relevant_crates(file_id).iter() {
75 let crate_def_map = self.crate_def_map(krate); 75 let crate_def_map = self.crate_def_map(krate);
76 for (module_id, data) in crate_def_map.modules.iter() { 76 for (local_id, data) in crate_def_map.modules.iter() {
77 if data.definition == Some(file_id) { 77 if data.definition == Some(file_id) {
78 return ModuleId { krate, module_id }; 78 return ModuleId { krate, local_id };
79 } 79 }
80 } 80 }
81 } 81 }
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs
index c1744663a..c8461b447 100644
--- a/crates/ra_hir_ty/src/tests.rs
+++ b/crates/ra_hir_ty/src/tests.rs
@@ -4677,7 +4677,7 @@ fn type_at_pos(db: &TestDB, pos: FilePosition) -> String {
4677 4677
4678 let module = db.module_for_file(pos.file_id); 4678 let module = db.module_for_file(pos.file_id);
4679 let crate_def_map = db.crate_def_map(module.krate); 4679 let crate_def_map = db.crate_def_map(module.krate);
4680 for decl in crate_def_map[module.module_id].scope.declarations() { 4680 for decl in crate_def_map[module.local_id].scope.declarations() {
4681 if let ModuleDefId::FunctionId(func) = decl { 4681 if let ModuleDefId::FunctionId(func) = decl {
4682 let (_body, source_map) = db.body_with_source_map(func.into()); 4682 let (_body, source_map) = db.body_with_source_map(func.into());
4683 if let Some(expr_id) = source_map.node_expr(Source::new(pos.file_id.into(), &expr)) { 4683 if let Some(expr_id) = source_map.node_expr(Source::new(pos.file_id.into(), &expr)) {
@@ -4753,7 +4753,7 @@ fn infer(content: &str) -> String {
4753 let crate_def_map = db.crate_def_map(module.krate); 4753 let crate_def_map = db.crate_def_map(module.krate);
4754 4754
4755 let mut defs: Vec<DefWithBodyId> = Vec::new(); 4755 let mut defs: Vec<DefWithBodyId> = Vec::new();
4756 visit_module(&db, &crate_def_map, module.module_id, &mut |it| defs.push(it)); 4756 visit_module(&db, &crate_def_map, module.local_id, &mut |it| defs.push(it));
4757 defs.sort_by_key(|def| match def { 4757 defs.sort_by_key(|def| match def {
4758 DefWithBodyId::FunctionId(it) => { 4758 DefWithBodyId::FunctionId(it) => {
4759 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start() 4759 it.lookup(&db).ast_id.to_node(&db).syntax().text_range().start()
@@ -4796,7 +4796,7 @@ fn visit_module(
4796 } 4796 }
4797 } 4797 }
4798 } 4798 }
4799 ModuleDefId::ModuleId(it) => visit_module(db, crate_def_map, it.module_id, cb), 4799 ModuleDefId::ModuleId(it) => visit_module(db, crate_def_map, it.local_id, cb),
4800 _ => (), 4800 _ => (),
4801 } 4801 }
4802 } 4802 }
@@ -4844,7 +4844,7 @@ fn typing_whitespace_inside_a_function_should_not_invalidate_types() {
4844 let events = db.log_executed(|| { 4844 let events = db.log_executed(|| {
4845 let module = db.module_for_file(pos.file_id); 4845 let module = db.module_for_file(pos.file_id);
4846 let crate_def_map = db.crate_def_map(module.krate); 4846 let crate_def_map = db.crate_def_map(module.krate);
4847 visit_module(&db, &crate_def_map, module.module_id, &mut |def| { 4847 visit_module(&db, &crate_def_map, module.local_id, &mut |def| {
4848 db.infer(def); 4848 db.infer(def);
4849 }); 4849 });
4850 }); 4850 });
@@ -4866,7 +4866,7 @@ fn typing_whitespace_inside_a_function_should_not_invalidate_types() {
4866 let events = db.log_executed(|| { 4866 let events = db.log_executed(|| {
4867 let module = db.module_for_file(pos.file_id); 4867 let module = db.module_for_file(pos.file_id);
4868 let crate_def_map = db.crate_def_map(module.krate); 4868 let crate_def_map = db.crate_def_map(module.krate);
4869 visit_module(&db, &crate_def_map, module.module_id, &mut |def| { 4869 visit_module(&db, &crate_def_map, module.local_id, &mut |def| {
4870 db.infer(def); 4870 db.infer(def);
4871 }); 4871 });
4872 }); 4872 });