aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/lib.rs17
-rw-r--r--crates/ra_hir_def/src/hygiene.rs6
-rw-r--r--crates/ra_hir_def/src/lib.rs1
-rw-r--r--crates/ra_hir_def/src/nameres/raw.rs11
-rw-r--r--crates/ra_hir_def/src/path.rs2
-rw-r--r--crates/ra_hir_expand/src/either.rs (renamed from crates/ra_hir_def/src/either.rs)0
-rw-r--r--crates/ra_hir_expand/src/lib.rs1
7 files changed, 16 insertions, 22 deletions
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index f765490b0..989818c0e 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -60,6 +60,13 @@ use crate::{ids::MacroFileKind, resolve::Resolver};
60 60
61pub use crate::{ 61pub use crate::{
62 adt::VariantDef, 62 adt::VariantDef,
63 code_model::{
64 docs::{DocDef, Docs, Documentation},
65 src::{HasBodySource, HasSource, Source},
66 Adt, AssocItem, BuiltinType, Const, ConstData, Container, Crate, CrateDependency,
67 DefWithBody, Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module,
68 ModuleDef, ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
69 },
63 expr::ExprScopes, 70 expr::ExprScopes,
64 from_source::FromSource, 71 from_source::FromSource,
65 generics::{GenericDef, GenericParam, GenericParams, HasGenericParams}, 72 generics::{GenericDef, GenericParam, GenericParams, HasGenericParams},
@@ -73,17 +80,9 @@ pub use crate::{
73 }, 80 },
74}; 81};
75 82
76pub use self::code_model::{
77 docs::{DocDef, Docs, Documentation},
78 src::{HasBodySource, HasSource, Source},
79 Adt, AssocItem, BuiltinType, Const, ConstData, Container, Crate, CrateDependency, DefWithBody,
80 Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module, ModuleDef,
81 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
82};
83
84pub use hir_def::{ 83pub use hir_def::{
85 either::Either,
86 name::Name, 84 name::Name,
87 path::{Path, PathKind}, 85 path::{Path, PathKind},
88 type_ref::Mutability, 86 type_ref::Mutability,
89}; 87};
88pub use hir_expand::either::Either;
diff --git a/crates/ra_hir_def/src/hygiene.rs b/crates/ra_hir_def/src/hygiene.rs
index e1ae58a3b..f51c46fcb 100644
--- a/crates/ra_hir_def/src/hygiene.rs
+++ b/crates/ra_hir_def/src/hygiene.rs
@@ -4,14 +4,12 @@
4//! this moment, this is horribly incomplete and handles only `$crate`. 4//! this moment, this is horribly incomplete and handles only `$crate`.
5// Should this be moved to `hir_expand`? Seems like it. 5// Should this be moved to `hir_expand`? Seems like it.
6 6
7use hir_expand::either::Either;
7use hir_expand::{db::AstDatabase, HirFileId}; 8use hir_expand::{db::AstDatabase, HirFileId};
8use ra_db::CrateId; 9use ra_db::CrateId;
9use ra_syntax::ast; 10use ra_syntax::ast;
10 11
11use crate::{ 12use crate::name::{AsName, Name};
12 either::Either,
13 name::{AsName, Name},
14};
15 13
16#[derive(Debug)] 14#[derive(Debug)]
17pub struct Hygiene { 15pub struct Hygiene {
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index 61ccdb30d..0de728dc1 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -8,7 +8,6 @@
8//! actually true. 8//! actually true.
9 9
10pub mod db; 10pub mod db;
11pub mod either;
12pub mod attr; 11pub mod attr;
13pub mod name; 12pub mod name;
14pub mod path; 13pub mod path;
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index 636364628..f1896c0cc 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -2,7 +2,7 @@
2 2
3use std::{ops::Index, sync::Arc}; 3use std::{ops::Index, sync::Arc};
4 4
5use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase}; 5use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either};
6use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; 6use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
7use ra_syntax::{ 7use ra_syntax::{
8 ast::{self, AttrsOwner, NameOwner}, 8 ast::{self, AttrsOwner, NameOwner},
@@ -12,7 +12,6 @@ use ra_syntax::{
12use crate::{ 12use crate::{
13 attr::Attr, 13 attr::Attr,
14 db::DefDatabase2, 14 db::DefDatabase2,
15 either::Either,
16 hygiene::Hygiene, 15 hygiene::Hygiene,
17 name::{AsName, Name}, 16 name::{AsName, Name},
18 path::Path, 17 path::Path,
@@ -41,10 +40,8 @@ pub struct ImportSourceMap {
41type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>; 40type ImportSourcePtr = Either<AstPtr<ast::UseTree>, AstPtr<ast::ExternCrateItem>>;
42type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>; 41type ImportSource = Either<ast::UseTree, ast::ExternCrateItem>;
43 42
44impl ImportSourcePtr { 43fn to_node(ptr: ImportSourcePtr, file: &SourceFile) -> ImportSource {
45 fn to_node(self, file: &SourceFile) -> ImportSource { 44 ptr.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax()))
46 self.map(|ptr| ptr.to_node(file.syntax()), |ptr| ptr.to_node(file.syntax()))
47 }
48} 45}
49 46
50impl ImportSourceMap { 47impl ImportSourceMap {
@@ -58,7 +55,7 @@ impl ImportSourceMap {
58 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(), 55 ModuleSource::Module(m) => m.syntax().ancestors().find_map(SourceFile::cast).unwrap(),
59 }; 56 };
60 57
61 self.map[import].to_node(&file) 58 to_node(self.map[import], &file)
62 } 59 }
63} 60}
64 61
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs
index 39f394c3f..8d57e7761 100644
--- a/crates/ra_hir_def/src/path.rs
+++ b/crates/ra_hir_def/src/path.rs
@@ -2,6 +2,7 @@
2 2
3use std::{iter, sync::Arc}; 3use std::{iter, sync::Arc};
4 4
5use hir_expand::either::Either;
5use ra_db::CrateId; 6use ra_db::CrateId;
6use ra_syntax::{ 7use ra_syntax::{
7 ast::{self, NameOwner, TypeAscriptionOwner}, 8 ast::{self, NameOwner, TypeAscriptionOwner},
@@ -9,7 +10,6 @@ use ra_syntax::{
9}; 10};
10 11
11use crate::{ 12use crate::{
12 either::Either,
13 hygiene::Hygiene, 13 hygiene::Hygiene,
14 name::{self, AsName, Name}, 14 name::{self, AsName, Name},
15 type_ref::TypeRef, 15 type_ref::TypeRef,
diff --git a/crates/ra_hir_def/src/either.rs b/crates/ra_hir_expand/src/either.rs
index 83583ef8b..83583ef8b 100644
--- a/crates/ra_hir_def/src/either.rs
+++ b/crates/ra_hir_expand/src/either.rs
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 3c0ef8f1c..6359b2b4d 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -6,6 +6,7 @@
6 6
7pub mod db; 7pub mod db;
8pub mod ast_id_map; 8pub mod ast_id_map;
9pub mod either;
9 10
10use std::hash::{Hash, Hasher}; 11use std::hash::{Hash, Hasher};
11 12