diff options
author | Aleksey Kladov <[email protected]> | 2019-10-30 15:56:20 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-10-30 15:56:20 +0000 |
commit | 872ac566bfc6cf43ac55354cf5223b962dbc1d92 (patch) | |
tree | 187da15a51e06cd3936d3f8c8e823f70c363a555 | |
parent | b05d6e53fb0e9a008dc2e1220b1201818e63ed2d (diff) |
push name down to hir_expand
-rw-r--r-- | crates/ra_hir/src/adt.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/lower.rs | 8 | ||||
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/generics.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/traits.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/expr.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/type_alias.rs | 7 | ||||
-rw-r--r-- | crates/ra_hir_def/src/hygiene.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 15 | ||||
-rw-r--r-- | crates/ra_hir_def/src/path.rs | 15 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/lib.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_expand/src/name.rs (renamed from crates/ra_hir_def/src/name.rs) | 0 |
21 files changed, 49 insertions, 50 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index d16b3a1cc..97424b39e 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs | |||
@@ -3,7 +3,8 @@ | |||
3 | 3 | ||
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::{name::AsName, type_ref::TypeRef}; | 6 | use hir_def::type_ref::TypeRef; |
7 | use hir_expand::name::AsName; | ||
7 | use ra_arena::{impl_arena_id, Arena, RawId}; | 8 | use ra_arena::{impl_arena_id, Arena, RawId}; |
8 | use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; | 9 | use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; |
9 | 10 | ||
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index d865c972e..a6ce23dd1 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -6,13 +6,13 @@ pub(crate) mod docs; | |||
6 | use std::sync::Arc; | 6 | use std::sync::Arc; |
7 | 7 | ||
8 | use hir_def::{ | 8 | use hir_def::{ |
9 | name::{ | ||
10 | self, AsName, BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, SELF_TYPE, STR, U128, | ||
11 | U16, U32, U64, U8, USIZE, | ||
12 | }, | ||
13 | type_ref::{Mutability, TypeRef}, | 9 | type_ref::{Mutability, TypeRef}, |
14 | CrateModuleId, ModuleId, | 10 | CrateModuleId, ModuleId, |
15 | }; | 11 | }; |
12 | use hir_expand::name::{ | ||
13 | self, AsName, BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, SELF_TYPE, STR, U128, U16, | ||
14 | U32, U64, U8, USIZE, | ||
15 | }; | ||
16 | use ra_db::{CrateId, Edition}; | 16 | use ra_db::{CrateId, Edition}; |
17 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; | 17 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; |
18 | 18 | ||
diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs index 575d78198..241ad68fd 100644 --- a/crates/ra_hir/src/expr/lower.rs +++ b/crates/ra_hir/src/expr/lower.rs | |||
@@ -1,11 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir_def::{ | 3 | use hir_def::{hygiene::Hygiene, path::GenericArgs, type_ref::TypeRef}; |
4 | hygiene::Hygiene, | 4 | use hir_expand::name::{self, AsName, Name}; |
5 | name::{self, AsName, Name}, | ||
6 | path::GenericArgs, | ||
7 | type_ref::TypeRef, | ||
8 | }; | ||
9 | use ra_arena::Arena; | 5 | use ra_arena::Arena; |
10 | use ra_syntax::{ | 6 | use ra_syntax::{ |
11 | ast::{ | 7 | ast::{ |
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index b9fbaa367..a9de01455 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir_def::name::AsName; | 3 | use hir_expand::name::AsName; |
4 | use ra_syntax::ast::{self, AstNode, NameOwner}; | 4 | use ra_syntax::ast::{self, AstNode, NameOwner}; |
5 | 5 | ||
6 | use crate::{ | 6 | use crate::{ |
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 9d5d18564..52e1fbf29 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs | |||
@@ -6,10 +6,10 @@ | |||
6 | use std::sync::Arc; | 6 | use std::sync::Arc; |
7 | 7 | ||
8 | use hir_def::{ | 8 | use hir_def::{ |
9 | name::{self, AsName}, | ||
10 | path::Path, | 9 | path::Path, |
11 | type_ref::{TypeBound, TypeRef}, | 10 | type_ref::{TypeBound, TypeRef}, |
12 | }; | 11 | }; |
12 | use hir_expand::name::{self, AsName}; | ||
13 | use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; | 13 | use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; |
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 989818c0e..603b0c3dc 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -81,8 +81,7 @@ pub use crate::{ | |||
81 | }; | 81 | }; |
82 | 82 | ||
83 | pub use hir_def::{ | 83 | pub use hir_def::{ |
84 | name::Name, | ||
85 | path::{Path, PathKind}, | 84 | path::{Path, PathKind}, |
86 | type_ref::Mutability, | 85 | type_ref::Mutability, |
87 | }; | 86 | }; |
88 | pub use hir_expand::either::Either; | 87 | pub use hir_expand::{either::Either, name::Name}; |
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs index 2f342870b..e2e13805a 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs | |||
@@ -1,6 +1,7 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use hir_def::{attr::Attr, name, nameres::raw}; | 3 | use hir_def::{attr::Attr, nameres::raw}; |
4 | use hir_expand::name; | ||
4 | use ra_cfg::CfgOptions; | 5 | use ra_cfg::CfgOptions; |
5 | use ra_db::FileId; | 6 | use ra_db::FileId; |
6 | use ra_syntax::{ast, SmolStr}; | 7 | use ra_syntax::{ast, SmolStr}; |
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 2a783b61e..f77c9df9f 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs | |||
@@ -2,10 +2,10 @@ | |||
2 | use std::sync::Arc; | 2 | use std::sync::Arc; |
3 | 3 | ||
4 | use hir_def::{ | 4 | use hir_def::{ |
5 | name::{self, Name}, | ||
6 | path::{Path, PathKind}, | 5 | path::{Path, PathKind}, |
7 | CrateModuleId, | 6 | CrateModuleId, |
8 | }; | 7 | }; |
8 | use hir_expand::name::{self, Name}; | ||
9 | use rustc_hash::FxHashSet; | 9 | use rustc_hash::FxHashSet; |
10 | 10 | ||
11 | use crate::{ | 11 | use crate::{ |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 544433a0a..01f51ba5d 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -7,7 +7,8 @@ | |||
7 | //! purely for "IDE needs". | 7 | //! purely for "IDE needs". |
8 | use std::sync::Arc; | 8 | use std::sync::Arc; |
9 | 9 | ||
10 | use hir_def::{name::AsName, path::known}; | 10 | use hir_def::path::known; |
11 | use hir_expand::name::AsName; | ||
11 | use ra_db::FileId; | 12 | use ra_db::FileId; |
12 | use ra_syntax::{ | 13 | use ra_syntax::{ |
13 | ast::{self, AstNode}, | 14 | ast::{self, AstNode}, |
diff --git a/crates/ra_hir/src/traits.rs b/crates/ra_hir/src/traits.rs index 514c813ab..1a45dacba 100644 --- a/crates/ra_hir/src/traits.rs +++ b/crates/ra_hir/src/traits.rs | |||
@@ -2,7 +2,8 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use hir_def::name::AsName; | 5 | use hir_expand::name::AsName; |
6 | |||
6 | use ra_syntax::ast::{self, NameOwner}; | 7 | use ra_syntax::ast::{self, NameOwner}; |
7 | use rustc_hash::FxHashMap; | 8 | use rustc_hash::FxHashMap; |
8 | 9 | ||
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index 03c45546d..3645ee831 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::name; | 8 | use hir_expand::name; |
9 | use log::{info, warn}; | 9 | use log::{info, warn}; |
10 | 10 | ||
11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs index 7466ee341..6694467a3 100644 --- a/crates/ra_hir/src/ty/infer.rs +++ b/crates/ra_hir/src/ty/infer.rs | |||
@@ -22,10 +22,10 @@ use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | |||
22 | use rustc_hash::FxHashMap; | 22 | use rustc_hash::FxHashMap; |
23 | 23 | ||
24 | use hir_def::{ | 24 | use hir_def::{ |
25 | name, | ||
26 | path::known, | 25 | path::known, |
27 | type_ref::{Mutability, TypeRef}, | 26 | type_ref::{Mutability, TypeRef}, |
28 | }; | 27 | }; |
28 | use hir_expand::name; | ||
29 | use ra_arena::map::ArenaMap; | 29 | use ra_arena::map::ArenaMap; |
30 | use ra_prof::profile; | 30 | use ra_prof::profile; |
31 | use test_utils::tested_by; | 31 | use test_utils::tested_by; |
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs index bc6437b44..fed52df39 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs | |||
@@ -3,10 +3,8 @@ | |||
3 | use std::iter::{repeat, repeat_with}; | 3 | use std::iter::{repeat, repeat_with}; |
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::{ | 6 | use hir_def::path::{GenericArg, GenericArgs}; |
7 | name, | 7 | use hir_expand::name; |
8 | path::{GenericArg, GenericArgs}, | ||
9 | }; | ||
10 | 8 | ||
11 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; | 9 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; |
12 | use crate::{ | 10 | use crate::{ |
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 2dd4c2fae..39ef92182 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -9,7 +9,8 @@ use chalk_ir::{ | |||
9 | }; | 9 | }; |
10 | use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; | 10 | use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; |
11 | 11 | ||
12 | use hir_def::name; | 12 | use hir_expand::name; |
13 | |||
13 | use ra_db::salsa::{InternId, InternKey}; | 14 | use ra_db::salsa::{InternId, InternKey}; |
14 | 15 | ||
15 | use super::{Canonical, ChalkContext, Impl, Obligation}; | 16 | use super::{Canonical, ChalkContext, Impl, Obligation}; |
diff --git a/crates/ra_hir/src/type_alias.rs b/crates/ra_hir/src/type_alias.rs index 87126ee7f..078e6295e 100644 --- a/crates/ra_hir/src/type_alias.rs +++ b/crates/ra_hir/src/type_alias.rs | |||
@@ -2,10 +2,9 @@ | |||
2 | 2 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use hir_def::{ | 5 | use hir_def::type_ref::TypeRef; |
6 | name::{AsName, Name}, | 6 | use hir_expand::name::{AsName, Name}; |
7 | type_ref::TypeRef, | 7 | |
8 | }; | ||
9 | use ra_syntax::ast::NameOwner; | 8 | use ra_syntax::ast::NameOwner; |
10 | 9 | ||
11 | use crate::{ | 10 | use crate::{ |
diff --git a/crates/ra_hir_def/src/hygiene.rs b/crates/ra_hir_def/src/hygiene.rs index f51c46fcb..94de2c57c 100644 --- a/crates/ra_hir_def/src/hygiene.rs +++ b/crates/ra_hir_def/src/hygiene.rs | |||
@@ -4,13 +4,15 @@ | |||
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 | ||
7 | use hir_expand::either::Either; | 7 | use hir_expand::{ |
8 | use hir_expand::{db::AstDatabase, HirFileId}; | 8 | db::AstDatabase, |
9 | either::Either, | ||
10 | name::{AsName, Name}, | ||
11 | HirFileId, | ||
12 | }; | ||
9 | use ra_db::CrateId; | 13 | use ra_db::CrateId; |
10 | use ra_syntax::ast; | 14 | use ra_syntax::ast; |
11 | 15 | ||
12 | use crate::name::{AsName, Name}; | ||
13 | |||
14 | #[derive(Debug)] | 16 | #[derive(Debug)] |
15 | pub struct Hygiene { | 17 | pub struct Hygiene { |
16 | // This is what `$crate` expands to | 18 | // This is what `$crate` expands to |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 0de728dc1..5135dda56 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | pub mod db; | 10 | pub mod db; |
11 | pub mod attr; | 11 | pub mod attr; |
12 | pub mod name; | ||
13 | pub mod path; | 12 | pub mod path; |
14 | pub mod type_ref; | 13 | pub mod type_ref; |
15 | pub mod hygiene; | 14 | pub mod hygiene; |
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index f1896c0cc..56831e409 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -2,7 +2,12 @@ | |||
2 | 2 | ||
3 | use std::{ops::Index, sync::Arc}; | 3 | use std::{ops::Index, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either}; | 5 | use hir_expand::{ |
6 | ast_id_map::AstIdMap, | ||
7 | db::AstDatabase, | ||
8 | either::Either, | ||
9 | name::{AsName, Name}, | ||
10 | }; | ||
6 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; | 11 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; |
7 | use ra_syntax::{ | 12 | use ra_syntax::{ |
8 | ast::{self, AttrsOwner, NameOwner}, | 13 | ast::{self, AttrsOwner, NameOwner}, |
@@ -10,12 +15,8 @@ use ra_syntax::{ | |||
10 | }; | 15 | }; |
11 | 16 | ||
12 | use crate::{ | 17 | use crate::{ |
13 | attr::Attr, | 18 | attr::Attr, db::DefDatabase2, hygiene::Hygiene, path::Path, FileAstId, HirFileId, ModuleSource, |
14 | db::DefDatabase2, | 19 | Source, |
15 | hygiene::Hygiene, | ||
16 | name::{AsName, Name}, | ||
17 | path::Path, | ||
18 | FileAstId, HirFileId, ModuleSource, Source, | ||
19 | }; | 20 | }; |
20 | 21 | ||
21 | /// `RawItems` is a set of top-level items in a file (except for impls). | 22 | /// `RawItems` is a set of top-level items in a file (except for impls). |
diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 8d57e7761..d0b842a6b 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs | |||
@@ -2,19 +2,17 @@ | |||
2 | 2 | ||
3 | use std::{iter, sync::Arc}; | 3 | use std::{iter, sync::Arc}; |
4 | 4 | ||
5 | use hir_expand::either::Either; | 5 | use hir_expand::{ |
6 | either::Either, | ||
7 | name::{self, AsName, Name}, | ||
8 | }; | ||
6 | use ra_db::CrateId; | 9 | use ra_db::CrateId; |
7 | use ra_syntax::{ | 10 | use ra_syntax::{ |
8 | ast::{self, NameOwner, TypeAscriptionOwner}, | 11 | ast::{self, NameOwner, TypeAscriptionOwner}, |
9 | AstNode, | 12 | AstNode, |
10 | }; | 13 | }; |
11 | 14 | ||
12 | use crate::{ | 15 | use crate::{hygiene::Hygiene, type_ref::TypeRef, Source}; |
13 | hygiene::Hygiene, | ||
14 | name::{self, AsName, Name}, | ||
15 | type_ref::TypeRef, | ||
16 | Source, | ||
17 | }; | ||
18 | 16 | ||
19 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 17 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
20 | pub struct Path { | 18 | pub struct Path { |
@@ -392,8 +390,9 @@ fn convert_path(prefix: Option<Path>, path: ast::Path, hygiene: &Hygiene) -> Opt | |||
392 | } | 390 | } |
393 | 391 | ||
394 | pub mod known { | 392 | pub mod known { |
393 | use hir_expand::name; | ||
394 | |||
395 | use super::{Path, PathKind}; | 395 | use super::{Path, PathKind}; |
396 | use crate::name; | ||
397 | 396 | ||
398 | pub fn std_iter_into_iterator() -> Path { | 397 | pub fn std_iter_into_iterator() -> Path { |
399 | Path::from_simple_segments( | 398 | Path::from_simple_segments( |
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 6359b2b4d..cf28de3d8 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs | |||
@@ -7,6 +7,7 @@ | |||
7 | pub mod db; | 7 | pub mod db; |
8 | pub mod ast_id_map; | 8 | pub mod ast_id_map; |
9 | pub mod either; | 9 | pub mod either; |
10 | pub mod name; | ||
10 | 11 | ||
11 | use std::hash::{Hash, Hasher}; | 12 | use std::hash::{Hash, Hasher}; |
12 | 13 | ||
diff --git a/crates/ra_hir_def/src/name.rs b/crates/ra_hir_expand/src/name.rs index 720896ee8..720896ee8 100644 --- a/crates/ra_hir_def/src/name.rs +++ b/crates/ra_hir_expand/src/name.rs | |||