aboutsummaryrefslogtreecommitdiff
path: root/crates/hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir')
-rw-r--r--crates/hir/src/code_model.rs22
-rw-r--r--crates/hir/src/from_id.rs6
-rw-r--r--crates/hir/src/has_source.rs6
-rw-r--r--crates/hir/src/lib.rs2
-rw-r--r--crates/hir/src/semantics.rs6
5 files changed, 21 insertions, 21 deletions
diff --git a/crates/hir/src/code_model.rs b/crates/hir/src/code_model.rs
index b1a1bc337..84e8c8047 100644
--- a/crates/hir/src/code_model.rs
+++ b/crates/hir/src/code_model.rs
@@ -402,9 +402,9 @@ impl Module {
402 def_map[self.id.local_id].scope.declarations().map(ModuleDef::from).collect() 402 def_map[self.id.local_id].scope.declarations().map(ModuleDef::from).collect()
403 } 403 }
404 404
405 pub fn impl_defs(self, db: &dyn HirDatabase) -> Vec<ImplDef> { 405 pub fn impl_defs(self, db: &dyn HirDatabase) -> Vec<Impl> {
406 let def_map = db.crate_def_map(self.id.krate); 406 let def_map = db.crate_def_map(self.id.krate);
407 def_map[self.id.local_id].scope.impls().map(ImplDef::from).collect() 407 def_map[self.id.local_id].scope.impls().map(Impl::from).collect()
408 } 408 }
409 409
410 pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module { 410 pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module {
@@ -1007,7 +1007,7 @@ pub enum AssocItem {
1007} 1007}
1008pub enum AssocItemContainer { 1008pub enum AssocItemContainer {
1009 Trait(Trait), 1009 Trait(Trait),
1010 ImplDef(ImplDef), 1010 Impl(Impl),
1011} 1011}
1012pub trait AsAssocItem { 1012pub trait AsAssocItem {
1013 fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem>; 1013 fn as_assoc_item(self, db: &dyn HirDatabase) -> Option<AssocItem>;
@@ -1064,7 +1064,7 @@ impl AssocItem {
1064 }; 1064 };
1065 match container { 1065 match container {
1066 AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()), 1066 AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()),
1067 AssocContainerId::ImplId(id) => AssocItemContainer::ImplDef(id.into()), 1067 AssocContainerId::ImplId(id) => AssocItemContainer::Impl(id.into()),
1068 AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"), 1068 AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"),
1069 } 1069 }
1070 } 1070 }
@@ -1086,7 +1086,7 @@ pub enum GenericDef {
1086 Adt(Adt), 1086 Adt(Adt),
1087 Trait(Trait), 1087 Trait(Trait),
1088 TypeAlias(TypeAlias), 1088 TypeAlias(TypeAlias),
1089 ImplDef(ImplDef), 1089 Impl(Impl),
1090 // enum variants cannot have generics themselves, but their parent enums 1090 // enum variants cannot have generics themselves, but their parent enums
1091 // can, and this makes some code easier to write 1091 // can, and this makes some code easier to write
1092 EnumVariant(EnumVariant), 1092 EnumVariant(EnumVariant),
@@ -1098,7 +1098,7 @@ impl_from!(
1098 Adt(Struct, Enum, Union), 1098 Adt(Struct, Enum, Union),
1099 Trait, 1099 Trait,
1100 TypeAlias, 1100 TypeAlias,
1101 ImplDef, 1101 Impl,
1102 EnumVariant, 1102 EnumVariant,
1103 Const 1103 Const
1104 for GenericDef 1104 for GenericDef
@@ -1268,18 +1268,18 @@ impl LifetimeParam {
1268 1268
1269// FIXME: rename from `ImplDef` to `Impl` 1269// FIXME: rename from `ImplDef` to `Impl`
1270#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 1270#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
1271pub struct ImplDef { 1271pub struct Impl {
1272 pub(crate) id: ImplId, 1272 pub(crate) id: ImplId,
1273} 1273}
1274 1274
1275impl ImplDef { 1275impl Impl {
1276 pub fn all_in_crate(db: &dyn HirDatabase, krate: Crate) -> Vec<ImplDef> { 1276 pub fn all_in_crate(db: &dyn HirDatabase, krate: Crate) -> Vec<Impl> {
1277 let inherent = db.inherent_impls_in_crate(krate.id); 1277 let inherent = db.inherent_impls_in_crate(krate.id);
1278 let trait_ = db.trait_impls_in_crate(krate.id); 1278 let trait_ = db.trait_impls_in_crate(krate.id);
1279 1279
1280 inherent.all_impls().chain(trait_.all_impls()).map(Self::from).collect() 1280 inherent.all_impls().chain(trait_.all_impls()).map(Self::from).collect()
1281 } 1281 }
1282 pub fn for_trait(db: &dyn HirDatabase, krate: Crate, trait_: Trait) -> Vec<ImplDef> { 1282 pub fn for_trait(db: &dyn HirDatabase, krate: Crate, trait_: Trait) -> Vec<Impl> {
1283 let impls = db.trait_impls_in_crate(krate.id); 1283 let impls = db.trait_impls_in_crate(krate.id);
1284 impls.for_trait(trait_.id).map(Self::from).collect() 1284 impls.for_trait(trait_.id).map(Self::from).collect()
1285 } 1285 }
@@ -1904,7 +1904,7 @@ pub enum ScopeDef {
1904 ModuleDef(ModuleDef), 1904 ModuleDef(ModuleDef),
1905 MacroDef(MacroDef), 1905 MacroDef(MacroDef),
1906 GenericParam(TypeParam), 1906 GenericParam(TypeParam),
1907 ImplSelfType(ImplDef), 1907 ImplSelfType(Impl),
1908 AdtSelfType(Adt), 1908 AdtSelfType(Adt),
1909 Local(Local), 1909 Local(Local),
1910 Unknown, 1910 Unknown,
diff --git a/crates/hir/src/from_id.rs b/crates/hir/src/from_id.rs
index dd3fcfe4a..8d0f84508 100644
--- a/crates/hir/src/from_id.rs
+++ b/crates/hir/src/from_id.rs
@@ -39,7 +39,7 @@ from_id![
39 (hir_def::StaticId, crate::Static), 39 (hir_def::StaticId, crate::Static),
40 (hir_def::ConstId, crate::Const), 40 (hir_def::ConstId, crate::Const),
41 (hir_def::FunctionId, crate::Function), 41 (hir_def::FunctionId, crate::Function),
42 (hir_def::ImplId, crate::ImplDef), 42 (hir_def::ImplId, crate::Impl),
43 (hir_def::TypeParamId, crate::TypeParam), 43 (hir_def::TypeParamId, crate::TypeParam),
44 (hir_def::LifetimeParamId, crate::LifetimeParam), 44 (hir_def::LifetimeParamId, crate::LifetimeParam),
45 (hir_expand::MacroDefId, crate::MacroDef) 45 (hir_expand::MacroDefId, crate::MacroDef)
@@ -146,7 +146,7 @@ impl From<GenericDef> for GenericDefId {
146 GenericDef::Adt(it) => GenericDefId::AdtId(it.into()), 146 GenericDef::Adt(it) => GenericDefId::AdtId(it.into()),
147 GenericDef::Trait(it) => GenericDefId::TraitId(it.id), 147 GenericDef::Trait(it) => GenericDefId::TraitId(it.id),
148 GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id), 148 GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id),
149 GenericDef::ImplDef(it) => GenericDefId::ImplId(it.id), 149 GenericDef::Impl(it) => GenericDefId::ImplId(it.id),
150 GenericDef::EnumVariant(it) => { 150 GenericDef::EnumVariant(it) => {
151 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id }) 151 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id })
152 } 152 }
@@ -162,7 +162,7 @@ impl From<GenericDefId> for GenericDef {
162 GenericDefId::AdtId(it) => GenericDef::Adt(it.into()), 162 GenericDefId::AdtId(it) => GenericDef::Adt(it.into()),
163 GenericDefId::TraitId(it) => GenericDef::Trait(it.into()), 163 GenericDefId::TraitId(it) => GenericDef::Trait(it.into()),
164 GenericDefId::TypeAliasId(it) => GenericDef::TypeAlias(it.into()), 164 GenericDefId::TypeAliasId(it) => GenericDef::TypeAlias(it.into()),
165 GenericDefId::ImplId(it) => GenericDef::ImplDef(it.into()), 165 GenericDefId::ImplId(it) => GenericDef::Impl(it.into()),
166 GenericDefId::EnumVariantId(it) => { 166 GenericDefId::EnumVariantId(it) => {
167 GenericDef::EnumVariant(EnumVariant { parent: it.parent.into(), id: it.local_id }) 167 GenericDef::EnumVariant(EnumVariant { parent: it.parent.into(), id: it.local_id })
168 } 168 }
diff --git a/crates/hir/src/has_source.rs b/crates/hir/src/has_source.rs
index 11ae63c31..c5b81b252 100644
--- a/crates/hir/src/has_source.rs
+++ b/crates/hir/src/has_source.rs
@@ -10,8 +10,8 @@ use hir_expand::InFile;
10use syntax::ast; 10use syntax::ast;
11 11
12use crate::{ 12use crate::{
13 db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, ImplDef, 13 db::HirDatabase, Const, Enum, EnumVariant, Field, FieldSource, Function, Impl, LifetimeParam,
14 LifetimeParam, MacroDef, Module, Static, Struct, Trait, TypeAlias, TypeParam, Union, 14 MacroDef, Module, Static, Struct, Trait, TypeAlias, TypeParam, Union,
15}; 15};
16 16
17pub trait HasSource { 17pub trait HasSource {
@@ -118,7 +118,7 @@ impl HasSource for MacroDef {
118 } 118 }
119 } 119 }
120} 120}
121impl HasSource for ImplDef { 121impl HasSource for Impl {
122 type Ast = ast::Impl; 122 type Ast = ast::Impl;
123 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> { 123 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> {
124 self.id.lookup(db.upcast()).source(db.upcast()) 124 self.id.lookup(db.upcast()).source(db.upcast())
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index 0f399a2c6..3f4f8d8e4 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -35,7 +35,7 @@ pub use crate::{
35 code_model::{ 35 code_model::{
36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const, 36 Access, Adt, AsAssocItem, AssocItem, AssocItemContainer, Callable, CallableKind, Const,
37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function, 37 Crate, CrateDependency, DefWithBody, Enum, EnumVariant, Field, FieldSource, Function,
38 GenericDef, HasVisibility, ImplDef, LifetimeParam, Local, MacroDef, Module, ModuleDef, 38 GenericDef, HasVisibility, Impl, LifetimeParam, Local, MacroDef, Module, ModuleDef,
39 ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, 39 ScopeDef, Static, Struct, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
40 }, 40 },
41 has_source::HasSource, 41 has_source::HasSource,
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index ee2074602..83ec91f58 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -25,7 +25,7 @@ use crate::{
25 diagnostics::Diagnostic, 25 diagnostics::Diagnostic,
26 semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx}, 26 semantics::source_to_def::{ChildContainer, SourceToDefCache, SourceToDefCtx},
27 source_analyzer::{resolve_hir_path, SourceAnalyzer}, 27 source_analyzer::{resolve_hir_path, SourceAnalyzer},
28 AssocItem, Callable, Crate, Field, Function, HirFileId, ImplDef, InFile, LifetimeParam, Local, 28 AssocItem, Callable, Crate, Field, Function, HirFileId, Impl, InFile, LifetimeParam, Local,
29 MacroDef, Module, ModuleDef, Name, Path, ScopeDef, Trait, Type, TypeAlias, TypeParam, 29 MacroDef, Module, ModuleDef, Name, Path, ScopeDef, Trait, Type, TypeAlias, TypeParam,
30 VariantDef, 30 VariantDef,
31}; 31};
@@ -38,7 +38,7 @@ pub enum PathResolution {
38 Local(Local), 38 Local(Local),
39 /// A generic parameter 39 /// A generic parameter
40 TypeParam(TypeParam), 40 TypeParam(TypeParam),
41 SelfType(ImplDef), 41 SelfType(Impl),
42 Macro(MacroDef), 42 Macro(MacroDef),
43 AssocItem(AssocItem), 43 AssocItem(AssocItem),
44} 44}
@@ -708,7 +708,7 @@ to_def_impls![
708 (crate::Enum, ast::Enum, enum_to_def), 708 (crate::Enum, ast::Enum, enum_to_def),
709 (crate::Union, ast::Union, union_to_def), 709 (crate::Union, ast::Union, union_to_def),
710 (crate::Trait, ast::Trait, trait_to_def), 710 (crate::Trait, ast::Trait, trait_to_def),
711 (crate::ImplDef, ast::Impl, impl_to_def), 711 (crate::Impl, ast::Impl, impl_to_def),
712 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), 712 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
713 (crate::Const, ast::Const, const_to_def), 713 (crate::Const, ast::Const, const_to_def),
714 (crate::Static, ast::Static, static_to_def), 714 (crate::Static, ast::Static, static_to_def),