From 544c63b58e3d571257239fd87036f1b6818e3b14 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 8 Jan 2019 15:57:45 +0300 Subject: dont reexport module id --- crates/ra_hir/src/code_model_impl/module.rs | 3 ++- crates/ra_hir/src/ids.rs | 5 ++++- crates/ra_hir/src/lib.rs | 1 - crates/ra_hir/src/nameres/tests.rs | 13 +++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/crates/ra_hir/src/code_model_impl/module.rs b/crates/ra_hir/src/code_model_impl/module.rs index 0d22c9dbe..56e14fac1 100644 --- a/crates/ra_hir/src/code_model_impl/module.rs +++ b/crates/ra_hir/src/code_model_impl/module.rs @@ -3,7 +3,8 @@ use ra_syntax::{ast, SyntaxNode, AstNode, TreePtr}; use crate::{ Module, ModuleSource, Problem, - Crate, DefId, DefLoc, DefKind, Name, Path, PathKind, PerNs, Def, ModuleId, + Crate, DefId, DefLoc, DefKind, Name, Path, PathKind, PerNs, Def, + module_tree::ModuleId, nameres::ModuleScope, db::HirDatabase, }; diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs index 730a3e542..bc8d4f3a8 100644 --- a/crates/ra_hir/src/ids.rs +++ b/crates/ra_hir/src/ids.rs @@ -2,7 +2,10 @@ use ra_db::{SourceRootId, LocationIntener, Cancelable, FileId}; use ra_syntax::{TreePtr, SyntaxKind, SyntaxNode, SourceFile, AstNode, ast}; use ra_arena::{Arena, RawId, impl_arena_id}; -use crate::{HirDatabase, PerNs, ModuleId, Def, Function, Struct, Enum, ImplBlock, Crate}; +use crate::{ + HirDatabase, PerNs, Def, Function, Struct, Enum, ImplBlock, Crate, + module_tree::ModuleId, +}; use crate::code_model_api::Module; diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index cd04575d1..f8ac28cf7 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -47,7 +47,6 @@ pub use self::{ name::Name, ids::{HirFileId, DefId, DefLoc, MacroCallId, MacroCallLoc}, macros::{MacroDef, MacroInput, MacroExpansion}, - module_tree::ModuleId, nameres::{ItemMap, PerNs, Namespace, Resolution}, function::{Function, FnSignature, FnScopes, ScopesWithSyntaxMapping}, ty::Ty, diff --git a/crates/ra_hir/src/nameres/tests.rs b/crates/ra_hir/src/nameres/tests.rs index 04faec4fb..82222d1ad 100644 --- a/crates/ra_hir/src/nameres/tests.rs +++ b/crates/ra_hir/src/nameres/tests.rs @@ -6,22 +6,23 @@ use relative_path::RelativePath; use test_utils::assert_eq_text; use crate::{ - self as hir, + ItemMap, Resolution, db::HirDatabase, mock::MockDatabase, + module_tree::ModuleId, }; -fn item_map(fixture: &str) -> (Arc, hir::ModuleId) { +fn item_map(fixture: &str) -> (Arc, ModuleId) { let (db, pos) = MockDatabase::with_position(fixture); let source_root = db.file_source_root(pos.file_id); - let module = hir::source_binder::module_from_position(&db, pos) + let module = crate::source_binder::module_from_position(&db, pos) .unwrap() .unwrap(); let module_id = module.def_id.loc(&db).module_id; (db.item_map(source_root).unwrap(), module_id) } -fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: &str) { +fn check_module_item_map(map: &ItemMap, module_id: ModuleId, expected: &str) { let mut lines = map.per_module[&module_id] .items .iter() @@ -37,7 +38,7 @@ fn check_module_item_map(map: &hir::ItemMap, module_id: hir::ModuleId, expected: .join("\n"); assert_eq_text!(&expected, &actual); - fn dump_resolution(resolution: &hir::Resolution) -> &'static str { + fn dump_resolution(resolution: &Resolution) -> &'static str { match ( resolution.def_id.types.is_some(), resolution.def_id.values.is_some(), @@ -181,7 +182,7 @@ fn item_map_across_crates() { db.set_crate_graph(crate_graph); let source_root = db.file_source_root(main_id); - let module = hir::source_binder::module_from_file_id(&db, main_id) + let module = crate::source_binder::module_from_file_id(&db, main_id) .unwrap() .unwrap(); let module_id = module.def_id.loc(&db).module_id; -- cgit v1.2.3