diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs index d16b3a1cce..97424b39e0 100644 --- a/crates/ra_hir/src/adt.rs +++ b/crates/ra_hir/src/adt.rs @@ -3,7 +3,8 @@ use std::sync::Arc; -use hir_def::{name::AsName, type_ref::TypeRef}; +use hir_def::type_ref::TypeRef; +use hir_expand::name::AsName; use ra_arena::{impl_arena_id, Arena, RawId}; use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index d865c972e3..a6ce23dd10 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; use std::sync::Arc; use hir_def::{ - name::{ - self, AsName, BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, SELF_TYPE, STR, U128, - U16, U32, U64, U8, USIZE, - }, type_ref::{Mutability, TypeRef}, CrateModuleId, ModuleId, }; +use hir_expand::name::{ + self, AsName, BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, SELF_TYPE, STR, U128, U16, + U32, U64, U8, USIZE, +}; use ra_db::{CrateId, Edition}; use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs index 575d78198c..241ad68fd8 100644 --- a/crates/ra_hir/src/expr/lower.rs +++ b/crates/ra_hir/src/expr/lower.rs @@ -1,11 +1,7 @@ //! FIXME: write short doc here -use hir_def::{ - hygiene::Hygiene, - name::{self, AsName, Name}, - path::GenericArgs, - type_ref::TypeRef, -}; +use hir_def::{hygiene::Hygiene, path::GenericArgs, type_ref::TypeRef}; +use hir_expand::name::{self, AsName, Name}; use ra_arena::Arena; use ra_syntax::{ ast::{ diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs index b9fbaa367f..a9de014553 100644 --- a/crates/ra_hir/src/from_source.rs +++ b/crates/ra_hir/src/from_source.rs @@ -1,6 +1,6 @@ //! FIXME: write short doc here -use hir_def::name::AsName; +use hir_expand::name::AsName; use ra_syntax::ast::{self, AstNode, NameOwner}; use crate::{ diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs index 9d5d185648..52e1fbf294 100644 --- a/crates/ra_hir/src/generics.rs +++ b/crates/ra_hir/src/generics.rs @@ -6,10 +6,10 @@ use std::sync::Arc; use hir_def::{ - name::{self, AsName}, path::Path, type_ref::{TypeBound, TypeRef}, }; +use hir_expand::name::{self, AsName}; use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; use crate::{ diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 989818c0e9..603b0c3dc3 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs @@ -81,8 +81,7 @@ pub use crate::{ }; pub use hir_def::{ - name::Name, path::{Path, PathKind}, type_ref::Mutability, }; -pub use hir_expand::either::Either; +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 2f342870b1..e2e13805ac 100644 --- a/crates/ra_hir/src/nameres/collector.rs +++ b/crates/ra_hir/src/nameres/collector.rs @@ -1,6 +1,7 @@ //! FIXME: write short doc here -use hir_def::{attr::Attr, name, nameres::raw}; +use hir_def::{attr::Attr, nameres::raw}; +use hir_expand::name; use ra_cfg::CfgOptions; use ra_db::FileId; use ra_syntax::{ast, SmolStr}; diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs index 2a783b61e3..f77c9df9f0 100644 --- a/crates/ra_hir/src/resolve.rs +++ b/crates/ra_hir/src/resolve.rs @@ -2,10 +2,10 @@ use std::sync::Arc; use hir_def::{ - name::{self, Name}, path::{Path, PathKind}, CrateModuleId, }; +use hir_expand::name::{self, Name}; use rustc_hash::FxHashSet; use crate::{ diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index 544433a0ab..01f51ba5d4 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs @@ -7,7 +7,8 @@ //! purely for "IDE needs". use std::sync::Arc; -use hir_def::{name::AsName, path::known}; +use hir_def::path::known; +use hir_expand::name::AsName; use ra_db::FileId; use ra_syntax::{ ast::{self, AstNode}, diff --git a/crates/ra_hir/src/traits.rs b/crates/ra_hir/src/traits.rs index 514c813ab1..1a45dacba9 100644 --- a/crates/ra_hir/src/traits.rs +++ b/crates/ra_hir/src/traits.rs @@ -2,7 +2,8 @@ use std::sync::Arc; -use hir_def::name::AsName; +use hir_expand::name::AsName; + use ra_syntax::ast::{self, NameOwner}; use rustc_hash::FxHashMap; diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs index 03c45546d2..3645ee831c 100644 --- a/crates/ra_hir/src/ty/autoderef.rs +++ b/crates/ra_hir/src/ty/autoderef.rs @@ -5,7 +5,7 @@ use std::iter::successors; -use hir_def::name; +use hir_expand::name; use log::{info, warn}; 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 7466ee3413..6694467a36 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}; use rustc_hash::FxHashMap; use hir_def::{ - name, path::known, type_ref::{Mutability, TypeRef}, }; +use hir_expand::name; use ra_arena::map::ArenaMap; use ra_prof::profile; 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 bc6437b448..fed52df39c 100644 --- a/crates/ra_hir/src/ty/infer/expr.rs +++ b/crates/ra_hir/src/ty/infer/expr.rs @@ -3,10 +3,8 @@ use std::iter::{repeat, repeat_with}; use std::sync::Arc; -use hir_def::{ - name, - path::{GenericArg, GenericArgs}, -}; +use hir_def::path::{GenericArg, GenericArgs}; +use hir_expand::name; use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; use crate::{ diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 2dd4c2fae5..39ef921827 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::{ }; use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; -use hir_def::name; +use hir_expand::name; + use ra_db::salsa::{InternId, InternKey}; 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 87126ee7f4..078e6295ea 100644 --- a/crates/ra_hir/src/type_alias.rs +++ b/crates/ra_hir/src/type_alias.rs @@ -2,10 +2,9 @@ use std::sync::Arc; -use hir_def::{ - name::{AsName, Name}, - type_ref::TypeRef, -}; +use hir_def::type_ref::TypeRef; +use hir_expand::name::{AsName, Name}; + use ra_syntax::ast::NameOwner; use crate::{ diff --git a/crates/ra_hir_def/src/hygiene.rs b/crates/ra_hir_def/src/hygiene.rs index f51c46fcb8..94de2c57c2 100644 --- a/crates/ra_hir_def/src/hygiene.rs +++ b/crates/ra_hir_def/src/hygiene.rs @@ -4,13 +4,15 @@ //! this moment, this is horribly incomplete and handles only `$crate`. // Should this be moved to `hir_expand`? Seems like it. -use hir_expand::either::Either; -use hir_expand::{db::AstDatabase, HirFileId}; +use hir_expand::{ + db::AstDatabase, + either::Either, + name::{AsName, Name}, + HirFileId, +}; use ra_db::CrateId; use ra_syntax::ast; -use crate::name::{AsName, Name}; - #[derive(Debug)] pub struct Hygiene { // 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 0de728dc1a..5135dda56a 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs @@ -9,7 +9,6 @@ pub mod db; pub mod attr; -pub mod name; pub mod path; pub mod type_ref; pub mod hygiene; diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index f1896c0cc0..56831e409f 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs @@ -2,7 +2,12 @@ use std::{ops::Index, sync::Arc}; -use hir_expand::{ast_id_map::AstIdMap, db::AstDatabase, either::Either}; +use hir_expand::{ + ast_id_map::AstIdMap, + db::AstDatabase, + either::Either, + name::{AsName, Name}, +}; use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; use ra_syntax::{ ast::{self, AttrsOwner, NameOwner}, @@ -10,12 +15,8 @@ use ra_syntax::{ }; use crate::{ - attr::Attr, - db::DefDatabase2, - hygiene::Hygiene, - name::{AsName, Name}, - path::Path, - FileAstId, HirFileId, ModuleSource, Source, + attr::Attr, db::DefDatabase2, hygiene::Hygiene, path::Path, FileAstId, HirFileId, ModuleSource, + Source, }; /// `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 8d57e77616..d0b842a6b1 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs @@ -2,19 +2,17 @@ use std::{iter, sync::Arc}; -use hir_expand::either::Either; +use hir_expand::{ + either::Either, + name::{self, AsName, Name}, +}; use ra_db::CrateId; use ra_syntax::{ ast::{self, NameOwner, TypeAscriptionOwner}, AstNode, }; -use crate::{ - hygiene::Hygiene, - name::{self, AsName, Name}, - type_ref::TypeRef, - Source, -}; +use crate::{hygiene::Hygiene, type_ref::TypeRef, Source}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Path { @@ -392,8 +390,9 @@ fn convert_path(prefix: Option, path: ast::Path, hygiene: &Hygiene) -> Opt } pub mod known { + use hir_expand::name; + use super::{Path, PathKind}; - use crate::name; pub fn std_iter_into_iterator() -> Path { Path::from_simple_segments( diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs index 6359b2b4d9..cf28de3d8c 100644 --- a/crates/ra_hir_expand/src/lib.rs +++ b/crates/ra_hir_expand/src/lib.rs @@ -7,6 +7,7 @@ pub mod db; pub mod ast_id_map; pub mod either; +pub mod name; use std::hash::{Hash, Hasher}; diff --git a/crates/ra_hir_def/src/name.rs b/crates/ra_hir_expand/src/name.rs similarity index 100% rename from crates/ra_hir_def/src/name.rs rename to crates/ra_hir_expand/src/name.rs