diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/adt.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 18 | ||||
-rw-r--r-- | crates/ra_hir/src/expr/lower.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/from_source.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/generics.rs | 14 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir/src/name.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/nameres/collector.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/resolve.rs | 20 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 5 | ||||
-rw-r--r-- | crates/ra_hir/src/traits.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/autoderef.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/infer/expr.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 3 | ||||
-rw-r--r-- | crates/ra_hir/src/type_alias.rs | 2 |
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 | ||
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::name::AsName; | ||
6 | use ra_arena::{impl_arena_id, Arena, RawId}; | 7 | use ra_arena::{impl_arena_id, Arena, RawId}; |
7 | use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; | 8 | use ra_syntax::ast::{self, NameOwner, StructKind, TypeAscriptionOwner}; |
8 | 9 | ||
9 | use crate::{ | 10 | use 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 | ||
15 | impl Struct { | 16 | impl 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 | ||
6 | use std::sync::Arc; | 6 | use std::sync::Arc; |
7 | 7 | ||
8 | use hir_def::{CrateModuleId, ModuleId}; | 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 | CrateModuleId, ModuleId, | ||
14 | }; | ||
9 | use ra_db::{CrateId, Edition}; | 15 | use ra_db::{CrateId, Edition}; |
10 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner}; | 16 | use 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 | ||
3 | use hir_def::name::{self, AsName, Name}; | ||
3 | use ra_arena::Arena; | 4 | use ra_arena::Arena; |
4 | use ra_syntax::{ | 5 | use ra_syntax::{ |
5 | ast::{ | 6 | ast::{ |
@@ -12,7 +13,6 @@ use test_utils::tested_by; | |||
12 | 13 | ||
13 | use crate::{ | 14 | use 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 | ||
3 | use hir_def::name::AsName; | ||
3 | use ra_syntax::ast::{self, AstNode, NameOwner}; | 4 | use ra_syntax::ast::{self, AstNode, NameOwner}; |
4 | 5 | ||
5 | use crate::{ | 6 | use 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 | ||
6 | use std::sync::Arc; | 6 | use std::sync::Arc; |
7 | 7 | ||
8 | use hir_def::name::{self, AsName}; | ||
8 | use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; | 9 | use ra_syntax::ast::{self, DefaultTypeParamOwner, NameOwner, TypeBoundsOwner, TypeParamsOwner}; |
9 | 10 | ||
10 | use crate::{ | 11 | use 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; | |||
36 | pub mod source_binder; | 36 | pub mod source_binder; |
37 | 37 | ||
38 | mod ids; | 38 | mod ids; |
39 | mod name; | ||
40 | mod nameres; | 39 | mod nameres; |
41 | mod adt; | 40 | mod adt; |
42 | mod traits; | 41 | mod traits; |
@@ -61,7 +60,7 @@ mod marks; | |||
61 | 60 | ||
62 | use hir_expand::AstId; | 61 | use hir_expand::AstId; |
63 | 62 | ||
64 | use crate::{ids::MacroFileKind, name::AsName, resolve::Resolver}; | 63 | use crate::{ids::MacroFileKind, resolve::Resolver}; |
65 | 64 | ||
66 | pub use crate::{ | 65 | pub 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 | |||
91 | pub 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 @@ | |||
1 | pub 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 | ||
3 | use hir_def::nameres::raw; | 3 | use hir_def::{name, nameres::raw}; |
4 | use ra_cfg::CfgOptions; | 4 | use ra_cfg::CfgOptions; |
5 | use ra_db::FileId; | 5 | use ra_db::FileId; |
6 | use ra_syntax::{ast, SmolStr}; | 6 | use 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 | ||
728 | fn is_macro_rules(path: &Path) -> bool { | 727 | fn 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. |
2 | use std::sync::Arc; | 2 | use std::sync::Arc; |
3 | 3 | ||
4 | use hir_def::CrateModuleId; | 4 | use hir_def::{ |
5 | name::{self, Name}, | ||
6 | CrateModuleId, | ||
7 | }; | ||
5 | use rustc_hash::FxHashSet; | 8 | use rustc_hash::FxHashSet; |
6 | 9 | ||
7 | use crate::{ | 10 | use 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". |
8 | use std::sync::Arc; | 8 | use std::sync::Arc; |
9 | 9 | ||
10 | use hir_def::name::AsName; | ||
10 | use ra_db::FileId; | 11 | use ra_db::FileId; |
11 | use ra_syntax::{ | 12 | use 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 | ||
34 | fn try_get_resolver_for_node( | 35 | fn 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 | ||
3 | use rustc_hash::FxHashMap; | ||
4 | use std::sync::Arc; | 3 | use std::sync::Arc; |
5 | 4 | ||
5 | use hir_def::name::AsName; | ||
6 | use ra_syntax::ast::{self, NameOwner}; | 6 | use ra_syntax::ast::{self, NameOwner}; |
7 | use rustc_hash::FxHashMap; | ||
7 | 8 | ||
8 | use crate::{ | 9 | use 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 | ||
6 | use std::iter::successors; | 6 | use std::iter::successors; |
7 | 7 | ||
8 | use hir_def::name; | ||
8 | use log::{info, warn}; | 9 | use log::{info, warn}; |
9 | 10 | ||
10 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; | 11 | use super::{traits::Solution, Canonical, Substs, Ty, TypeWalk}; |
11 | use crate::{db::HirDatabase, name, HasGenericParams, Resolver}; | 12 | use crate::{db::HirDatabase, HasGenericParams, Resolver}; |
12 | 13 | ||
13 | const AUTODEREF_RECURSION_LIMIT: usize = 10; | 14 | const 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; | |||
21 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; | 21 | use ena::unify::{InPlaceUnificationTable, NoError, UnifyKey, UnifyValue}; |
22 | use rustc_hash::FxHashMap; | 22 | use rustc_hash::FxHashMap; |
23 | 23 | ||
24 | use hir_def::name; | ||
24 | use ra_arena::map::ArenaMap; | 25 | use ra_arena::map::ArenaMap; |
25 | use ra_prof::profile; | 26 | use ra_prof::profile; |
26 | use test_utils::tested_by; | 27 | use 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 @@ | |||
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::name; | ||
7 | |||
6 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; | 8 | use super::{BindingMode, Expectation, InferenceContext, InferenceDiagnostic, TypeMismatch}; |
7 | use crate::{ | 9 | use 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 | }; |
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 ra_db::salsa::{InternId, InternKey}; | 13 | use ra_db::salsa::{InternId, InternKey}; |
13 | 14 | ||
14 | use super::{Canonical, ChalkContext, Impl, Obligation}; | 15 | use 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 | ||
3 | use std::sync::Arc; | 3 | use std::sync::Arc; |
4 | 4 | ||
5 | use hir_def::name::{AsName, Name}; | ||
5 | use ra_syntax::ast::NameOwner; | 6 | use ra_syntax::ast::NameOwner; |
6 | 7 | ||
7 | use crate::{ | 8 | use 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 | }; |