diff options
Diffstat (limited to 'crates/ra_hir_def/src')
-rw-r--r-- | crates/ra_hir_def/src/body/lower.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/data.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/keys.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lang_item.rs | 10 | ||||
-rw-r--r-- | crates/ra_hir_def/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_def/src/resolver.rs | 20 |
7 files changed, 24 insertions, 24 deletions
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index b3fb6d452..c18e6879b 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -544,7 +544,7 @@ where | |||
544 | let ast_id = self.expander.ast_id(&def); | 544 | let ast_id = self.expander.ast_id(&def); |
545 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) | 545 | (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) |
546 | } | 546 | } |
547 | ast::ModuleItem::ImplBlock(_) | 547 | ast::ModuleItem::ImplDef(_) |
548 | | ast::ModuleItem::UseItem(_) | 548 | | ast::ModuleItem::UseItem(_) |
549 | | ast::ModuleItem::ExternCrateItem(_) | 549 | | ast::ModuleItem::ExternCrateItem(_) |
550 | | ast::ModuleItem::Module(_) => continue, | 550 | | ast::ModuleItem::Module(_) => continue, |
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs index c900a6a18..c5fb9428e 100644 --- a/crates/ra_hir_def/src/data.rs +++ b/crates/ra_hir_def/src/data.rs | |||
@@ -238,16 +238,16 @@ impl ConstData { | |||
238 | fn collect_impl_items_in_macros( | 238 | fn collect_impl_items_in_macros( |
239 | db: &impl DefDatabase, | 239 | db: &impl DefDatabase, |
240 | module_id: ModuleId, | 240 | module_id: ModuleId, |
241 | impl_block: &InFile<ast::ItemList>, | 241 | impl_def: &InFile<ast::ItemList>, |
242 | id: ImplId, | 242 | id: ImplId, |
243 | ) -> Vec<AssocItemId> { | 243 | ) -> Vec<AssocItemId> { |
244 | let mut expander = Expander::new(db, impl_block.file_id, module_id); | 244 | let mut expander = Expander::new(db, impl_def.file_id, module_id); |
245 | let mut res = Vec::new(); | 245 | let mut res = Vec::new(); |
246 | 246 | ||
247 | // We set a limit to protect against infinite recursion | 247 | // We set a limit to protect against infinite recursion |
248 | let limit = 100; | 248 | let limit = 100; |
249 | 249 | ||
250 | for m in impl_block.value.syntax().children().filter_map(ast::MacroCall::cast) { | 250 | for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) { |
251 | res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) | 251 | res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) |
252 | } | 252 | } |
253 | 253 | ||
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index 5913f12b1..8cd70eb9a 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs | |||
@@ -18,7 +18,7 @@ pub const FUNCTION: Key<ast::FnDef, FunctionId> = Key::new(); | |||
18 | pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); | 18 | pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); |
19 | pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); | 19 | pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); |
20 | pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new(); | 20 | pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new(); |
21 | pub const IMPL: Key<ast::ImplBlock, ImplId> = Key::new(); | 21 | pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); |
22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); | 22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); |
23 | pub const STRUCT: Key<ast::StructDef, StructId> = Key::new(); | 23 | pub const STRUCT: Key<ast::StructDef, StructId> = Key::new(); |
24 | pub const UNION: Key<ast::UnionDef, UnionId> = Key::new(); | 24 | pub const UNION: Key<ast::UnionDef, UnionId> = Key::new(); |
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs index 37c861a87..5a336ea1f 100644 --- a/crates/ra_hir_def/src/lang_item.rs +++ b/crates/ra_hir_def/src/lang_item.rs | |||
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | pub enum LangItemTarget { | 16 | pub enum LangItemTarget { |
17 | EnumId(EnumId), | 17 | EnumId(EnumId), |
18 | FunctionId(FunctionId), | 18 | FunctionId(FunctionId), |
19 | ImplBlockId(ImplId), | 19 | ImplDefId(ImplId), |
20 | StaticId(StaticId), | 20 | StaticId(StaticId), |
21 | StructId(StructId), | 21 | StructId(StructId), |
22 | TraitId(TraitId), | 22 | TraitId(TraitId), |
@@ -37,9 +37,9 @@ impl LangItemTarget { | |||
37 | } | 37 | } |
38 | } | 38 | } |
39 | 39 | ||
40 | pub fn as_impl_block(self) -> Option<ImplId> { | 40 | pub fn as_impl_def(self) -> Option<ImplId> { |
41 | match self { | 41 | match self { |
42 | LangItemTarget::ImplBlockId(id) => Some(id), | 42 | LangItemTarget::ImplDefId(id) => Some(id), |
43 | _ => None, | 43 | _ => None, |
44 | } | 44 | } |
45 | } | 45 | } |
@@ -125,8 +125,8 @@ impl LangItems { | |||
125 | // Look for impl targets | 125 | // Look for impl targets |
126 | let def_map = db.crate_def_map(module.krate); | 126 | let def_map = db.crate_def_map(module.krate); |
127 | let module_data = &def_map[module.local_id]; | 127 | let module_data = &def_map[module.local_id]; |
128 | for impl_block in module_data.scope.impls() { | 128 | for impl_def in module_data.scope.impls() { |
129 | self.collect_lang_item(db, impl_block, LangItemTarget::ImplBlockId) | 129 | self.collect_lang_item(db, impl_def, LangItemTarget::ImplDefId) |
130 | } | 130 | } |
131 | 131 | ||
132 | for def in module_data.scope.declarations() { | 132 | for def in module_data.scope.declarations() { |
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs index 564b5fec5..c9b14d0c8 100644 --- a/crates/ra_hir_def/src/lib.rs +++ b/crates/ra_hir_def/src/lib.rs | |||
@@ -164,7 +164,7 @@ impl_intern!(TypeAliasId, TypeAliasLoc, intern_type_alias, lookup_intern_type_al | |||
164 | 164 | ||
165 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 165 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
166 | pub struct ImplId(salsa::InternId); | 166 | pub struct ImplId(salsa::InternId); |
167 | type ImplLoc = ItemLoc<ast::ImplBlock>; | 167 | type ImplLoc = ItemLoc<ast::ImplDef>; |
168 | impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl); | 168 | impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl); |
169 | 169 | ||
170 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | 170 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] |
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index 0e8c9da76..ea3c00da8 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -213,7 +213,7 @@ impl_arena_id!(Impl); | |||
213 | 213 | ||
214 | #[derive(Debug, PartialEq, Eq)] | 214 | #[derive(Debug, PartialEq, Eq)] |
215 | pub(super) struct ImplData { | 215 | pub(super) struct ImplData { |
216 | pub(super) ast_id: FileAstId<ast::ImplBlock>, | 216 | pub(super) ast_id: FileAstId<ast::ImplDef>, |
217 | } | 217 | } |
218 | 218 | ||
219 | struct RawItemsCollector { | 219 | struct RawItemsCollector { |
@@ -249,7 +249,7 @@ impl RawItemsCollector { | |||
249 | self.add_extern_crate_item(current_module, extern_crate); | 249 | self.add_extern_crate_item(current_module, extern_crate); |
250 | return; | 250 | return; |
251 | } | 251 | } |
252 | ast::ModuleItem::ImplBlock(it) => { | 252 | ast::ModuleItem::ImplDef(it) => { |
253 | self.add_impl(current_module, it); | 253 | self.add_impl(current_module, it); |
254 | return; | 254 | return; |
255 | } | 255 | } |
@@ -395,7 +395,7 @@ impl RawItemsCollector { | |||
395 | self.push_item(current_module, attrs, RawItemKind::Macro(m)); | 395 | self.push_item(current_module, attrs, RawItemKind::Macro(m)); |
396 | } | 396 | } |
397 | 397 | ||
398 | fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplBlock) { | 398 | fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplDef) { |
399 | let attrs = self.parse_attrs(&imp); | 399 | let attrs = self.parse_attrs(&imp); |
400 | let ast_id = self.source_ast_id_map.ast_id(&imp); | 400 | let ast_id = self.source_ast_id_map.ast_id(&imp); |
401 | let imp = self.raw_items.impls.alloc(ImplData { ast_id }); | 401 | let imp = self.raw_items.impls.alloc(ImplData { ast_id }); |
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs index 9dd4fa555..2734d51a0 100644 --- a/crates/ra_hir_def/src/resolver.rs +++ b/crates/ra_hir_def/src/resolver.rs | |||
@@ -52,7 +52,7 @@ enum Scope { | |||
52 | /// Brings the generic parameters of an item into scope | 52 | /// Brings the generic parameters of an item into scope |
53 | GenericParams { def: GenericDefId, params: Arc<GenericParams> }, | 53 | GenericParams { def: GenericDefId, params: Arc<GenericParams> }, |
54 | /// Brings `Self` in `impl` block into scope | 54 | /// Brings `Self` in `impl` block into scope |
55 | ImplBlockScope(ImplId), | 55 | ImplDefScope(ImplId), |
56 | /// Brings `Self` in enum, struct and union definitions into scope | 56 | /// Brings `Self` in enum, struct and union definitions into scope |
57 | AdtScope(AdtId), | 57 | AdtScope(AdtId), |
58 | /// Local bindings | 58 | /// Local bindings |
@@ -154,7 +154,7 @@ impl Resolver { | |||
154 | match scope { | 154 | match scope { |
155 | Scope::ExprScope(_) => continue, | 155 | Scope::ExprScope(_) => continue, |
156 | Scope::GenericParams { .. } | 156 | Scope::GenericParams { .. } |
157 | | Scope::ImplBlockScope(_) | 157 | | Scope::ImplDefScope(_) |
158 | | Scope::LocalItemsScope(_) | 158 | | Scope::LocalItemsScope(_) |
159 | if skip_to_mod => | 159 | if skip_to_mod => |
160 | { | 160 | { |
@@ -170,7 +170,7 @@ impl Resolver { | |||
170 | )); | 170 | )); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | Scope::ImplBlockScope(impl_) => { | 173 | Scope::ImplDefScope(impl_) => { |
174 | if first_name == &name![Self] { | 174 | if first_name == &name![Self] { |
175 | let idx = if path.segments.len() == 1 { None } else { Some(1) }; | 175 | let idx = if path.segments.len() == 1 { None } else { Some(1) }; |
176 | return Some((TypeNs::SelfType(*impl_), idx)); | 176 | return Some((TypeNs::SelfType(*impl_), idx)); |
@@ -263,7 +263,7 @@ impl Resolver { | |||
263 | Scope::AdtScope(_) | 263 | Scope::AdtScope(_) |
264 | | Scope::ExprScope(_) | 264 | | Scope::ExprScope(_) |
265 | | Scope::GenericParams { .. } | 265 | | Scope::GenericParams { .. } |
266 | | Scope::ImplBlockScope(_) | 266 | | Scope::ImplDefScope(_) |
267 | | Scope::LocalItemsScope(_) | 267 | | Scope::LocalItemsScope(_) |
268 | if skip_to_mod => | 268 | if skip_to_mod => |
269 | { | 269 | { |
@@ -291,7 +291,7 @@ impl Resolver { | |||
291 | } | 291 | } |
292 | Scope::GenericParams { .. } => continue, | 292 | Scope::GenericParams { .. } => continue, |
293 | 293 | ||
294 | Scope::ImplBlockScope(impl_) if n_segments > 1 => { | 294 | Scope::ImplDefScope(impl_) if n_segments > 1 => { |
295 | if first_name == &name![Self] { | 295 | if first_name == &name![Self] { |
296 | let ty = TypeNs::SelfType(*impl_); | 296 | let ty = TypeNs::SelfType(*impl_); |
297 | return Some(ResolveValueResult::Partial(ty, 1)); | 297 | return Some(ResolveValueResult::Partial(ty, 1)); |
@@ -303,7 +303,7 @@ impl Resolver { | |||
303 | return Some(ResolveValueResult::Partial(ty, 1)); | 303 | return Some(ResolveValueResult::Partial(ty, 1)); |
304 | } | 304 | } |
305 | } | 305 | } |
306 | Scope::ImplBlockScope(_) | Scope::AdtScope(_) => continue, | 306 | Scope::ImplDefScope(_) | Scope::AdtScope(_) => continue, |
307 | 307 | ||
308 | Scope::ModuleScope(m) => { | 308 | Scope::ModuleScope(m) => { |
309 | let (module_def, idx) = m.crate_def_map.resolve_path( | 309 | let (module_def, idx) = m.crate_def_map.resolve_path( |
@@ -503,7 +503,7 @@ impl Scope { | |||
503 | } | 503 | } |
504 | } | 504 | } |
505 | } | 505 | } |
506 | Scope::ImplBlockScope(i) => { | 506 | Scope::ImplDefScope(i) => { |
507 | f(name![Self], ScopeDef::ImplSelfType(*i)); | 507 | f(name![Self], ScopeDef::ImplSelfType(*i)); |
508 | } | 508 | } |
509 | Scope::AdtScope(i) => { | 509 | Scope::AdtScope(i) => { |
@@ -550,8 +550,8 @@ impl Resolver { | |||
550 | self.push_scope(Scope::GenericParams { def, params }) | 550 | self.push_scope(Scope::GenericParams { def, params }) |
551 | } | 551 | } |
552 | 552 | ||
553 | fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver { | 553 | fn push_impl_def_scope(self, impl_def: ImplId) -> Resolver { |
554 | self.push_scope(Scope::ImplBlockScope(impl_block)) | 554 | self.push_scope(Scope::ImplDefScope(impl_def)) |
555 | } | 555 | } |
556 | 556 | ||
557 | fn push_module_scope( | 557 | fn push_module_scope( |
@@ -634,7 +634,7 @@ impl HasResolver for ImplId { | |||
634 | .container | 634 | .container |
635 | .resolver(db) | 635 | .resolver(db) |
636 | .push_generic_params_scope(db, self.into()) | 636 | .push_generic_params_scope(db, self.into()) |
637 | .push_impl_block_scope(self) | 637 | .push_impl_def_scope(self) |
638 | } | 638 | } |
639 | } | 639 | } |
640 | 640 | ||