aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-10-30 14:19:30 +0000
committerAleksey Kladov <[email protected]>2019-10-30 14:43:14 +0000
commitf8ddef875af08f6c67fe69f7803f3926bc6f66bb (patch)
treeed4704070c4e5bb9db7225b1f5af753b83864661 /crates
parent16e620c052016010b2f17070a98bdc1e7e849ab3 (diff)
remove forward pointer for name
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_hir/src/adt.rs3
-rw-r--r--crates/ra_hir/src/code_model.rs18
-rw-r--r--crates/ra_hir/src/expr/lower.rs4
-rw-r--r--crates/ra_hir/src/from_source.rs2
-rw-r--r--crates/ra_hir/src/generics.rs14
-rw-r--r--crates/ra_hir/src/lib.rs6
-rw-r--r--crates/ra_hir/src/name.rs1
-rw-r--r--crates/ra_hir/src/nameres/collector.rs5
-rw-r--r--crates/ra_hir/src/resolve.rs20
-rw-r--r--crates/ra_hir/src/source_binder.rs5
-rw-r--r--crates/ra_hir/src/traits.rs4
-rw-r--r--crates/ra_hir/src/ty/autoderef.rs3
-rw-r--r--crates/ra_hir/src/ty/infer.rs2
-rw-r--r--crates/ra_hir/src/ty/infer/expr.rs3
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs3
-rw-r--r--crates/ra_hir/src/type_alias.rs2
16 files changed, 52 insertions, 43 deletions
diff --git a/crates/ra_hir/src/adt.rs b/crates/ra_hir/src/adt.rs
index 3e9cd3c63..ce64980bb 100644
--- a/crates/ra_hir/src/adt.rs
+++ b/crates/ra_hir/src/adt.rs
@@ -3,13 +3,14 @@
3 3
4use std::sync::Arc; 4use std::sync::Arc;
5 5
6use hir_def::name::AsName;
6use ra_arena::{impl_arena_id, Arena, RawId}; 7use ra_arena::{impl_arena_id, Arena, RawId};
7use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; 8use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner};
8 9
9use crate::{ 10use crate::{
10 db::{AstDatabase, DefDatabase, HirDatabase}, 11 db::{AstDatabase, DefDatabase, HirDatabase},
11 type_ref::TypeRef, 12 type_ref::TypeRef,
12 AsName, Enum, EnumVariant, FieldSource, HasSource, Module, Name, Source, Struct, StructField, 13 Enum, EnumVariant, FieldSource, HasSource, Module, Name, Source, Struct, StructField,
13}; 14};
14 15
15impl Struct { 16impl Struct {
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index de1377aa4..7848d0a3f 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -5,7 +5,13 @@ pub(crate) mod docs;
5 5
6use std::sync::Arc; 6use std::sync::Arc;
7 7
8use hir_def::{CrateModuleId, ModuleId}; 8use 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 CrateModuleId, ModuleId,
14};
9use ra_db::{CrateId, Edition}; 15use ra_db::{CrateId, Edition};
10use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; 16use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner};
11 17
@@ -20,10 +26,6 @@ use crate::{
20 TypeAliasId, 26 TypeAliasId,
21 }, 27 },
22 impl_block::ImplBlock, 28 impl_block::ImplBlock,
23 name::{
24 BOOL, CHAR, F32, F64, I128, I16, I32, I64, I8, ISIZE, SELF_TYPE, STR, U128, U16, U32, U64,
25 U8, USIZE,
26 },
27 nameres::{ImportId, ModuleScope, Namespace}, 29 nameres::{ImportId, ModuleScope, Namespace},
28 resolve::{Resolver, Scope, TypeNs}, 30 resolve::{Resolver, Scope, TypeNs},
29 traits::TraitData, 31 traits::TraitData,
@@ -33,7 +35,7 @@ use crate::{
33 }, 35 },
34 type_ref::Mutability, 36 type_ref::Mutability,
35 type_ref::TypeRef, 37 type_ref::TypeRef,
36 AsName, Either, HasSource, Name, Ty, 38 Either, HasSource, Name, Ty,
37}; 39};
38 40
39/// hir::Crate describes a single crate. It's the main interface with which 41/// hir::Crate describes a single crate. It's the main interface with which
@@ -898,9 +900,7 @@ impl Trait {
898 .where_predicates 900 .where_predicates
899 .iter() 901 .iter()
900 .filter_map(|pred| match &pred.type_ref { 902 .filter_map(|pred| match &pred.type_ref {
901 TypeRef::Path(p) if p.as_ident() == Some(&crate::name::SELF_TYPE) => { 903 TypeRef::Path(p) if p.as_ident() == Some(&name::SELF_TYPE) => pred.bound.as_path(),
902 pred.bound.as_path()
903 }
904 _ => None, 904 _ => None,
905 }) 905 })
906 .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) { 906 .filter_map(|path| match resolver.resolve_path_in_type_ns_fully(db, path) {
diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs
index b3a9a2e6b..cf8a41b1e 100644
--- a/crates/ra_hir/src/expr/lower.rs
+++ b/crates/ra_hir/src/expr/lower.rs
@@ -1,5 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::name::{self, AsName, Name};
3use ra_arena::Arena; 4use ra_arena::Arena;
4use ra_syntax::{ 5use ra_syntax::{
5 ast::{ 6 ast::{
@@ -12,7 +13,6 @@ use test_utils::tested_by;
12 13
13use crate::{ 14use crate::{
14 db::HirDatabase, 15 db::HirDatabase,
15 name::{AsName, Name, SELF_PARAM},
16 path::GenericArgs, 16 path::GenericArgs,
17 ty::primitive::{FloatTy, IntTy, UncertainFloatTy, UncertainIntTy}, 17 ty::primitive::{FloatTy, IntTy, UncertainFloatTy, UncertainIntTy},
18 type_ref::TypeRef, 18 type_ref::TypeRef,
@@ -78,7 +78,7 @@ where
78 let ptr = AstPtr::new(&self_param); 78 let ptr = AstPtr::new(&self_param);
79 let param_pat = self.alloc_pat( 79 let param_pat = self.alloc_pat(
80 Pat::Bind { 80 Pat::Bind {
81 name: SELF_PARAM, 81 name: name::SELF_PARAM,
82 mode: BindingAnnotation::Unannotated, 82 mode: BindingAnnotation::Unannotated,
83 subpat: None, 83 subpat: None,
84 }, 84 },
diff --git a/crates/ra_hir/src/from_source.rs b/crates/ra_hir/src/from_source.rs
index 697c8dc84..b9fbaa367 100644
--- a/crates/ra_hir/src/from_source.rs
+++ b/crates/ra_hir/src/from_source.rs
@@ -1,11 +1,11 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::name::AsName;
3use ra_syntax::ast::{self, AstNode, NameOwner}; 4use ra_syntax::ast::{self, AstNode, NameOwner};
4 5
5use crate::{ 6use crate::{
6 db::{AstDatabase, DefDatabase, HirDatabase}, 7 db::{AstDatabase, DefDatabase, HirDatabase},
7 ids::{AstItemDef, LocationCtx}, 8 ids::{AstItemDef, LocationCtx},
8 name::AsName,
9 AstId, Const, Crate, Enum, EnumVariant, FieldSource, Function, HasSource, ImplBlock, Module, 9 AstId, Const, Crate, Enum, EnumVariant, FieldSource, Function, HasSource, ImplBlock, Module,
10 ModuleSource, Source, Static, Struct, StructField, Trait, TypeAlias, Union, VariantDef, 10 ModuleSource, Source, Static, Struct, StructField, Trait, TypeAlias, Union, VariantDef,
11}; 11};
diff --git a/crates/ra_hir/src/generics.rs b/crates/ra_hir/src/generics.rs
index 4ce7551c3..61786a614 100644
--- a/crates/ra_hir/src/generics.rs
+++ b/crates/ra_hir/src/generics.rs
@@ -5,15 +5,15 @@
5 5
6use std::sync::Arc; 6use std::sync::Arc;
7 7
8use hir_def::name::{self, AsName};
8use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; 9use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner};
9 10
10use crate::{ 11use crate::{
11 db::{AstDatabase, DefDatabase, HirDatabase}, 12 db::{AstDatabase, DefDatabase, HirDatabase},
12 name::SELF_TYPE,
13 path::Path, 13 path::Path,
14 type_ref::{TypeBound, TypeRef}, 14 type_ref::{TypeBound, TypeRef},
15 Adt, AsName, Const, Container, Enum, EnumVariant, Function, HasSource, ImplBlock, Name, Struct, 15 Adt, Const, Container, Enum, EnumVariant, Function, HasSource, ImplBlock, Name, Struct, Trait,
16 Trait, TypeAlias, Union, 16 TypeAlias, Union,
17}; 17};
18 18
19/// Data about a generic parameter (to a function, struct, impl, ...). 19/// Data about a generic parameter (to a function, struct, impl, ...).
@@ -94,11 +94,15 @@ impl GenericParams {
94 GenericDef::Adt(Adt::Enum(it)) => generics.fill(&it.source(db).ast, start), 94 GenericDef::Adt(Adt::Enum(it)) => generics.fill(&it.source(db).ast, start),
95 GenericDef::Trait(it) => { 95 GenericDef::Trait(it) => {
96 // traits get the Self type as an implicit first type parameter 96 // traits get the Self type as an implicit first type parameter
97 generics.params.push(GenericParam { idx: start, name: SELF_TYPE, default: None }); 97 generics.params.push(GenericParam {
98 idx: start,
99 name: name::SELF_TYPE,
100 default: None,
101 });
98 generics.fill(&it.source(db).ast, start + 1); 102 generics.fill(&it.source(db).ast, start + 1);
99 // add super traits as bounds on Self 103 // add super traits as bounds on Self
100 // i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar 104 // i.e., trait Foo: Bar is equivalent to trait Foo where Self: Bar
101 let self_param = TypeRef::Path(SELF_TYPE.into()); 105 let self_param = TypeRef::Path(name::SELF_TYPE.into());
102 generics.fill_bounds(&it.source(db).ast, self_param); 106 generics.fill_bounds(&it.source(db).ast, self_param);
103 } 107 }
104 GenericDef::TypeAlias(it) => generics.fill(&it.source(db).ast, start), 108 GenericDef::TypeAlias(it) => generics.fill(&it.source(db).ast, start),
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index b49f615bf..620911459 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -36,7 +36,6 @@ mod path;
36pub mod source_binder; 36pub mod source_binder;
37 37
38mod ids; 38mod ids;
39mod name;
40mod nameres; 39mod nameres;
41mod adt; 40mod adt;
42mod traits; 41mod traits;
@@ -61,7 +60,7 @@ mod marks;
61 60
62use hir_expand::AstId; 61use hir_expand::AstId;
63 62
64use crate::{ids::MacroFileKind, name::AsName, resolve::Resolver}; 63use crate::{ids::MacroFileKind, resolve::Resolver};
65 64
66pub use crate::{ 65pub use crate::{
67 adt::VariantDef, 66 adt::VariantDef,
@@ -71,7 +70,6 @@ pub use crate::{
71 generics::{GenericDef, GenericParam, GenericParams, HasGenericParams}, 70 generics::{GenericDef, GenericParam, GenericParams, HasGenericParams},
72 ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile}, 71 ids::{HirFileId, MacroCallId, MacroCallLoc, MacroDefId, MacroFile},
73 impl_block::ImplBlock, 72 impl_block::ImplBlock,
74 name::Name,
75 nameres::{ImportId, Namespace, PerNs}, 73 nameres::{ImportId, Namespace, PerNs},
76 path::{Path, PathKind}, 74 path::{Path, PathKind},
77 resolve::ScopeDef, 75 resolve::ScopeDef,
@@ -89,3 +87,5 @@ pub use self::code_model::{
89 Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module, ModuleDef, 87 Enum, EnumVariant, FieldSource, FnData, Function, HasBody, MacroDef, Module, ModuleDef,
90 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union, 88 ModuleSource, Static, Struct, StructField, Trait, TypeAlias, Union,
91}; 89};
90
91pub use hir_def::name::Name;
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
deleted file mode 100644
index cf66f88ad..000000000
--- a/crates/ra_hir/src/name.rs
+++ /dev/null
@@ -1 +0,0 @@
1pub use hir_def::name::*;
diff --git a/crates/ra_hir/src/nameres/collector.rs b/crates/ra_hir/src/nameres/collector.rs
index 2dd0a5877..1f3849dc7 100644
--- a/crates/ra_hir/src/nameres/collector.rs
+++ b/crates/ra_hir/src/nameres/collector.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::nameres::raw; 3use hir_def::{name, nameres::raw};
4use ra_cfg::CfgOptions; 4use ra_cfg::CfgOptions;
5use ra_db::FileId; 5use ra_db::FileId;
6use ra_syntax::{ast, SmolStr}; 6use ra_syntax::{ast, SmolStr};
@@ -11,7 +11,6 @@ use crate::{
11 attr::Attr, 11 attr::Attr,
12 db::DefDatabase, 12 db::DefDatabase,
13 ids::{AstItemDef, LocationCtx, MacroCallId, MacroCallLoc, MacroDefId, MacroFileKind}, 13 ids::{AstItemDef, LocationCtx, MacroCallId, MacroCallLoc, MacroDefId, MacroFileKind},
14 name::MACRO_RULES,
15 nameres::{ 14 nameres::{
16 diagnostics::DefDiagnostic, mod_resolution::ModDir, Crate, CrateDefMap, CrateModuleId, 15 diagnostics::DefDiagnostic, mod_resolution::ModDir, Crate, CrateDefMap, CrateModuleId,
17 ModuleData, ModuleDef, PerNs, ReachedFixedPoint, Resolution, ResolveMode, 16 ModuleData, ModuleDef, PerNs, ReachedFixedPoint, Resolution, ResolveMode,
@@ -726,7 +725,7 @@ where
726} 725}
727 726
728fn is_macro_rules(path: &Path) -> bool { 727fn is_macro_rules(path: &Path) -> bool {
729 path.as_ident() == Some(&MACRO_RULES) 728 path.as_ident() == Some(&name::MACRO_RULES)
730} 729}
731 730
732#[cfg(test)] 731#[cfg(test)]
diff --git a/crates/ra_hir/src/resolve.rs b/crates/ra_hir/src/resolve.rs
index 8b6269407..b9459552b 100644
--- a/crates/ra_hir/src/resolve.rs
+++ b/crates/ra_hir/src/resolve.rs
@@ -1,7 +1,10 @@
1//! Name resolution. 1//! Name resolution.
2use std::sync::Arc; 2use std::sync::Arc;
3 3
4use hir_def::CrateModuleId; 4use hir_def::{
5 name::{self, Name},
6 CrateModuleId,
7};
5use rustc_hash::FxHashSet; 8use rustc_hash::FxHashSet;
6 9
7use crate::{ 10use crate::{
@@ -13,7 +16,6 @@ use crate::{
13 }, 16 },
14 generics::GenericParams, 17 generics::GenericParams,
15 impl_block::ImplBlock, 18 impl_block::ImplBlock,
16 name::{Name, SELF_PARAM, SELF_TYPE},
17 nameres::{CrateDefMap, PerNs}, 19 nameres::{CrateDefMap, PerNs},
18 path::{Path, PathKind}, 20 path::{Path, PathKind},
19 Adt, BuiltinType, Const, Enum, EnumVariant, Function, MacroDef, ModuleDef, Static, Struct, 21 Adt, BuiltinType, Const, Enum, EnumVariant, Function, MacroDef, ModuleDef, Static, Struct,
@@ -150,13 +152,13 @@ impl Resolver {
150 } 152 }
151 } 153 }
152 Scope::ImplBlockScope(impl_) => { 154 Scope::ImplBlockScope(impl_) => {
153 if first_name == &SELF_TYPE { 155 if first_name == &name::SELF_TYPE {
154 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 156 let idx = if path.segments.len() == 1 { None } else { Some(1) };
155 return Some((TypeNs::SelfType(*impl_), idx)); 157 return Some((TypeNs::SelfType(*impl_), idx));
156 } 158 }
157 } 159 }
158 Scope::AdtScope(adt) => { 160 Scope::AdtScope(adt) => {
159 if first_name == &SELF_TYPE { 161 if first_name == &name::SELF_TYPE {
160 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 162 let idx = if path.segments.len() == 1 { None } else { Some(1) };
161 return Some((TypeNs::AdtSelfType(*adt), idx)); 163 return Some((TypeNs::AdtSelfType(*adt), idx));
162 } 164 }
@@ -205,7 +207,7 @@ impl Resolver {
205 return None; 207 return None;
206 } 208 }
207 let n_segments = path.segments.len(); 209 let n_segments = path.segments.len();
208 let tmp = SELF_PARAM; 210 let tmp = name::SELF_PARAM;
209 let first_name = if path.is_self() { &tmp } else { &path.segments.first()?.name }; 211 let first_name = if path.is_self() { &tmp } else { &path.segments.first()?.name };
210 let skip_to_mod = path.kind != PathKind::Plain && !path.is_self(); 212 let skip_to_mod = path.kind != PathKind::Plain && !path.is_self();
211 for scope in self.scopes.iter().rev() { 213 for scope in self.scopes.iter().rev() {
@@ -241,13 +243,13 @@ impl Resolver {
241 Scope::GenericParams(_) => continue, 243 Scope::GenericParams(_) => continue,
242 244
243 Scope::ImplBlockScope(impl_) if n_segments > 1 => { 245 Scope::ImplBlockScope(impl_) if n_segments > 1 => {
244 if first_name == &SELF_TYPE { 246 if first_name == &name::SELF_TYPE {
245 let ty = TypeNs::SelfType(*impl_); 247 let ty = TypeNs::SelfType(*impl_);
246 return Some(ResolveValueResult::Partial(ty, 1)); 248 return Some(ResolveValueResult::Partial(ty, 1));
247 } 249 }
248 } 250 }
249 Scope::AdtScope(adt) if n_segments > 1 => { 251 Scope::AdtScope(adt) if n_segments > 1 => {
250 if first_name == &SELF_TYPE { 252 if first_name == &name::SELF_TYPE {
251 let ty = TypeNs::AdtSelfType(*adt); 253 let ty = TypeNs::AdtSelfType(*adt);
252 return Some(ResolveValueResult::Partial(ty, 1)); 254 return Some(ResolveValueResult::Partial(ty, 1));
253 } 255 }
@@ -459,10 +461,10 @@ impl Scope {
459 } 461 }
460 } 462 }
461 Scope::ImplBlockScope(i) => { 463 Scope::ImplBlockScope(i) => {
462 f(SELF_TYPE, ScopeDef::ImplSelfType(*i)); 464 f(name::SELF_TYPE, ScopeDef::ImplSelfType(*i));
463 } 465 }
464 Scope::AdtScope(i) => { 466 Scope::AdtScope(i) => {
465 f(SELF_TYPE, ScopeDef::AdtSelfType(*i)); 467 f(name::SELF_TYPE, ScopeDef::AdtSelfType(*i));
466 } 468 }
467 Scope::ExprScope(e) => { 469 Scope::ExprScope(e) => {
468 e.expr_scopes.entries(e.scope_id).iter().for_each(|e| { 470 e.expr_scopes.entries(e.scope_id).iter().for_each(|e| {
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs
index 730c33226..8a1fa29a4 100644
--- a/crates/ra_hir/src/source_binder.rs
+++ b/crates/ra_hir/src/source_binder.rs
@@ -7,6 +7,7 @@
7//! purely for "IDE needs". 7//! purely for "IDE needs".
8use std::sync::Arc; 8use std::sync::Arc;
9 9
10use hir_def::name::AsName;
10use ra_db::FileId; 11use ra_db::FileId;
11use ra_syntax::{ 12use ra_syntax::{
12 ast::{self, AstNode}, 13 ast::{self, AstNode},
@@ -27,8 +28,8 @@ use crate::{
27 path::known, 28 path::known,
28 resolve::{ScopeDef, TypeNs, ValueNs}, 29 resolve::{ScopeDef, TypeNs, ValueNs},
29 ty::method_resolution::implements_trait, 30 ty::method_resolution::implements_trait,
30 AsName, Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, MacroDef, 31 Const, DefWithBody, Either, Enum, FromSource, Function, HasBody, HirFileId, MacroDef, Module,
31 Module, Name, Path, Resolver, Static, Struct, Ty, 32 Name, Path, Resolver, Static, Struct, Ty,
32}; 33};
33 34
34fn try_get_resolver_for_node( 35fn try_get_resolver_for_node(
diff --git a/crates/ra_hir/src/traits.rs b/crates/ra_hir/src/traits.rs
index 22f188049..514c813ab 100644
--- a/crates/ra_hir/src/traits.rs
+++ b/crates/ra_hir/src/traits.rs
@@ -1,14 +1,14 @@
1//! HIR for trait definitions. 1//! HIR for trait definitions.
2 2
3use rustc_hash::FxHashMap;
4use std::sync::Arc; 3use std::sync::Arc;
5 4
5use hir_def::name::AsName;
6use ra_syntax::ast::{self, NameOwner}; 6use ra_syntax::ast::{self, NameOwner};
7use rustc_hash::FxHashMap;
7 8
8use crate::{ 9use crate::{
9 db::{AstDatabase, DefDatabase}, 10 db::{AstDatabase, DefDatabase},
10 ids::LocationCtx, 11 ids::LocationCtx,
11 name::AsName,
12 AssocItem, Const, Function, HasSource, Module, Name, Trait, TypeAlias, 12 AssocItem, Const, Function, HasSource, Module, Name, Trait, TypeAlias,
13}; 13};
14 14
diff --git a/crates/ra_hir/src/ty/autoderef.rs b/crates/ra_hir/src/ty/autoderef.rs
index 02492ca14..03c45546d 100644
--- a/crates/ra_hir/src/ty/autoderef.rs
+++ b/crates/ra_hir/src/ty/autoderef.rs
@@ -5,10 +5,11 @@
5 5
6use std::iter::successors; 6use std::iter::successors;
7 7
8use hir_def::name;
8use log::{info, warn}; 9use log::{info, warn};
9 10
10use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; 11use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk};
11use crate::{db::HirDatabase, name, HasGenericParams, Resolver}; 12use crate::{db::HirDatabase, HasGenericParams, Resolver};
12 13
13const AUTODEREF_RECURSION_LIMIT: usize = 10; 14const AUTODEREF_RECURSION_LIMIT: usize = 10;
14 15
diff --git a/crates/ra_hir/src/ty/infer.rs b/crates/ra_hir/src/ty/infer.rs
index ebaff998e..92b8e718e 100644
--- a/crates/ra_hir/src/ty/infer.rs
+++ b/crates/ra_hir/src/ty/infer.rs
@@ -21,6 +21,7 @@ use std::sync::Arc;
21use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; 21use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue};
22use rustc_hash::FxHashMap; 22use rustc_hash::FxHashMap;
23 23
24use hir_def::name;
24use ra_arena::map::ArenaMap; 25use ra_arena::map::ArenaMap;
25use ra_prof::profile; 26use ra_prof::profile;
26use test_utils::tested_by; 27use test_utils::tested_by;
@@ -37,7 +38,6 @@ use crate::{
37 db::HirDatabase, 38 db::HirDatabase,
38 diagnostics::DiagnosticSink, 39 diagnostics::DiagnosticSink,
39 expr::{BindingAnnotation, Body, ExprId, PatId}, 40 expr::{BindingAnnotation, Body, ExprId, PatId},
40 name,
41 path::known, 41 path::known,
42 resolve::{Resolver, TypeNs}, 42 resolve::{Resolver, TypeNs},
43 ty::infer::diagnostics::InferenceDiagnostic, 43 ty::infer::diagnostics::InferenceDiagnostic,
diff --git a/crates/ra_hir/src/ty/infer/expr.rs b/crates/ra_hir/src/ty/infer/expr.rs
index f8807c742..7ef87bfe2 100644
--- a/crates/ra_hir/src/ty/infer/expr.rs
+++ b/crates/ra_hir/src/ty/infer/expr.rs
@@ -3,12 +3,13 @@
3use std::iter::{repeat, repeat_with}; 3use std::iter::{repeat, repeat_with};
4use std::sync::Arc; 4use std::sync::Arc;
5 5
6use hir_def::name;
7
6use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; 8use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch};
7use crate::{ 9use crate::{
8 db::HirDatabase, 10 db::HirDatabase,
9 expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp}, 11 expr::{self, Array, BinaryOp, Expr, ExprId, Literal, Statement, UnaryOp},
10 generics::{GenericParams, HasGenericParams}, 12 generics::{GenericParams, HasGenericParams},
11 name,
12 nameres::Namespace, 13 nameres::Namespace,
13 path::{GenericArg, GenericArgs}, 14 path::{GenericArg, GenericArgs},
14 ty::{ 15 ty::{
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index ab66515be..2dd4c2fae 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -9,6 +9,7 @@ use chalk_ir::{
9}; 9};
10use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum}; 10use chalk_rust_ir::{AssociatedTyDatum, ImplDatum, StructDatum, TraitDatum};
11 11
12use hir_def::name;
12use ra_db::salsa::{InternId, InternKey}; 13use ra_db::salsa::{InternId, InternKey};
13 14
14use super::{Canonical, ChalkContext, Impl, Obligation}; 15use super::{Canonical, ChalkContext, Impl, Obligation};
@@ -734,7 +735,7 @@ fn closure_fn_trait_impl_datum(
734 substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(), 735 substs: Substs::build_for_def(db, trait_).push(self_ty).push(arg_ty).build(),
735 }; 736 };
736 737
737 let output_ty_id = fn_once_trait.associated_type_by_name(db, &crate::name::OUTPUT_TYPE)?; 738 let output_ty_id = fn_once_trait.associated_type_by_name(db, &name::OUTPUT_TYPE)?;
738 739
739 let output_ty_value = chalk_rust_ir::AssociatedTyValue { 740 let output_ty_value = chalk_rust_ir::AssociatedTyValue {
740 associated_ty_id: output_ty_id.to_chalk(db), 741 associated_ty_id: output_ty_id.to_chalk(db),
diff --git a/crates/ra_hir/src/type_alias.rs b/crates/ra_hir/src/type_alias.rs
index 674a46102..18c01e1b9 100644
--- a/crates/ra_hir/src/type_alias.rs
+++ b/crates/ra_hir/src/type_alias.rs
@@ -2,11 +2,11 @@
2 2
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use hir_def::name::{AsName, Name};
5use ra_syntax::ast::NameOwner; 6use ra_syntax::ast::NameOwner;
6 7
7use crate::{ 8use crate::{
8 db::{AstDatabase, DefDatabase}, 9 db::{AstDatabase, DefDatabase},
9 name::{AsName, Name},
10 type_ref::TypeRef, 10 type_ref::TypeRef,
11 HasSource, TypeAlias, 11 HasSource, TypeAlias,
12}; 12};