From 6636f56e79b55f22b88094b7edaed6ec88880500 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 00:23:03 +0200 Subject: Rename ModuleItem -> Item --- crates/ra_hir_def/src/item_tree/lower.rs | 72 +++++++++++++++----------------- 1 file changed, 34 insertions(+), 38 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index f79b8fca3..eb1da4632 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -70,19 +70,19 @@ impl Ctx { self.tree.data_mut() } - fn lower_mod_item(&mut self, item: &ast::ModuleItem, inner: bool) -> Option { + fn lower_mod_item(&mut self, item: &ast::Item, inner: bool) -> Option { assert!(inner || self.inner_items.is_empty()); // Collect inner items for 1-to-1-lowered items. match item { - ast::ModuleItem::StructDef(_) - | ast::ModuleItem::UnionDef(_) - | ast::ModuleItem::EnumDef(_) - | ast::ModuleItem::FnDef(_) - | ast::ModuleItem::TypeAliasDef(_) - | ast::ModuleItem::ConstDef(_) - | ast::ModuleItem::StaticDef(_) - | ast::ModuleItem::MacroCall(_) => { + ast::Item::StructDef(_) + | ast::Item::UnionDef(_) + | ast::Item::EnumDef(_) + | ast::Item::FnDef(_) + | ast::Item::TypeAliasDef(_) + | ast::Item::ConstDef(_) + | ast::Item::StaticDef(_) + | ast::Item::MacroCall(_) => { // Skip this if we're already collecting inner items. We'll descend into all nodes // already. if !inner { @@ -92,34 +92,30 @@ impl Ctx { // These are handled in their respective `lower_X` method (since we can't just blindly // walk them). - ast::ModuleItem::TraitDef(_) - | ast::ModuleItem::ImplDef(_) - | ast::ModuleItem::ExternBlock(_) => {} + ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} // These don't have inner items. - ast::ModuleItem::Module(_) - | ast::ModuleItem::ExternCrateItem(_) - | ast::ModuleItem::UseItem(_) => {} + ast::Item::Module(_) | ast::Item::ExternCrateItem(_) | ast::Item::UseItem(_) => {} }; let attrs = Attrs::new(item, &self.hygiene); let items = match item { - ast::ModuleItem::StructDef(ast) => self.lower_struct(ast).map(Into::into), - ast::ModuleItem::UnionDef(ast) => self.lower_union(ast).map(Into::into), - ast::ModuleItem::EnumDef(ast) => self.lower_enum(ast).map(Into::into), - ast::ModuleItem::FnDef(ast) => self.lower_function(ast).map(Into::into), - ast::ModuleItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), - ast::ModuleItem::StaticDef(ast) => self.lower_static(ast).map(Into::into), - ast::ModuleItem::ConstDef(ast) => Some(self.lower_const(ast).into()), - ast::ModuleItem::Module(ast) => self.lower_module(ast).map(Into::into), - ast::ModuleItem::TraitDef(ast) => self.lower_trait(ast).map(Into::into), - ast::ModuleItem::ImplDef(ast) => self.lower_impl(ast).map(Into::into), - ast::ModuleItem::UseItem(ast) => Some(ModItems( + ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), + ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), + ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), + ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into), + ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), + ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), + ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), + ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), + ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), + ast::Item::UseItem(ast) => Some(ModItems( self.lower_use(ast).into_iter().map(Into::into).collect::>(), )), - ast::ModuleItem::ExternCrateItem(ast) => self.lower_extern_crate(ast).map(Into::into), - ast::ModuleItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), - ast::ModuleItem::ExternBlock(ast) => { + ast::Item::ExternCrateItem(ast) => self.lower_extern_crate(ast).map(Into::into), + ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), + ast::Item::ExternBlock(ast) => { Some(ModItems(self.lower_extern_block(ast).into_iter().collect::>())) } }; @@ -147,22 +143,22 @@ impl Ctx { fn collect_inner_items(&mut self, container: &SyntaxNode) { let forced_vis = self.forced_visibility.take(); let mut inner_items = mem::take(&mut self.tree.inner_items); - inner_items.extend( - container.descendants().skip(1).filter_map(ast::ModuleItem::cast).filter_map(|item| { + inner_items.extend(container.descendants().skip(1).filter_map(ast::Item::cast).filter_map( + |item| { let ast_id = self.source_ast_id_map.ast_id(&item); Some((ast_id, self.lower_mod_item(&item, true)?.0)) - }), - ); + }, + )); self.tree.inner_items = inner_items; self.forced_visibility = forced_vis; } - fn lower_assoc_item(&mut self, item: &ast::ModuleItem) -> Option { + fn lower_assoc_item(&mut self, item: &ast::Item) -> Option { match item { - ast::ModuleItem::FnDef(ast) => self.lower_function(ast).map(Into::into), - ast::ModuleItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), - ast::ModuleItem::ConstDef(ast) => Some(self.lower_const(ast).into()), - ast::ModuleItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), + ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into), + ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), + ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), _ => None, } } -- cgit v1.2.3 From 2984da672e0c73d56501c6b6e4d19fd28152b5eb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 11:42:51 +0200 Subject: Split ItemList & AssocItemList --- crates/ra_hir_def/src/item_tree/lower.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index eb1da4632..4fc21a642 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -153,13 +153,12 @@ impl Ctx { self.forced_visibility = forced_vis; } - fn lower_assoc_item(&mut self, item: &ast::Item) -> Option { + fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option { match item { - ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into), - ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), - ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), - ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), - _ => None, + ast::AssocItem::FnDef(ast) => self.lower_function(ast).map(Into::into), + ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), + ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), } } @@ -419,9 +418,9 @@ impl Ctx { let generic_params = self.lower_generic_params_and_inner_items(GenericsOwner::Trait(trait_def), trait_def); let auto = trait_def.auto_token().is_some(); - let items = trait_def.item_list().map(|list| { + let items = trait_def.assoc_item_list().map(|list| { self.with_inherited_visibility(visibility, |this| { - list.items() + list.assoc_items() .filter_map(|item| { let attrs = Attrs::new(&item, &this.hygiene); this.collect_inner_items(item.syntax()); @@ -454,9 +453,9 @@ impl Ctx { // We cannot use `assoc_items()` here as that does not include macro calls. let items = impl_def - .item_list() + .assoc_item_list() .into_iter() - .flat_map(|it| it.items()) + .flat_map(|it| it.assoc_items()) .filter_map(|item| { self.collect_inner_items(item.syntax()); let assoc = self.lower_assoc_item(&item)?; -- cgit v1.2.3 From 6cd2131cafd29ae17442efbcce652bd447576f27 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 11:58:41 +0200 Subject: Rename Rename --- crates/ra_hir_def/src/item_tree/lower.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 4fc21a642..6c58c6378 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -501,7 +501,7 @@ impl Ctx { extern_crate: &ast::ExternCrateItem, ) -> Option> { let path = ModPath::from_name_ref(&extern_crate.name_ref()?); - let alias = extern_crate.alias().map(|a| { + let alias = extern_crate.rename().map(|a| { a.name().map(|it| it.as_name()).map_or(ImportAlias::Underscore, ImportAlias::Alias) }); let visibility = self.lower_visibility(extern_crate); -- cgit v1.2.3 From d032f872b619c651dc66bfd669ef783108fc122c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 12:26:57 +0200 Subject: Finish extern crates grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 6c58c6378..8a36de311 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -95,7 +95,7 @@ impl Ctx { ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} // These don't have inner items. - ast::Item::Module(_) | ast::Item::ExternCrateItem(_) | ast::Item::UseItem(_) => {} + ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::UseItem(_) => {} }; let attrs = Attrs::new(item, &self.hygiene); @@ -113,7 +113,7 @@ impl Ctx { ast::Item::UseItem(ast) => Some(ModItems( self.lower_use(ast).into_iter().map(Into::into).collect::>(), )), - ast::Item::ExternCrateItem(ast) => self.lower_extern_crate(ast).map(Into::into), + ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into), ast::Item::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), ast::Item::ExternBlock(ast) => { Some(ModItems(self.lower_extern_block(ast).into_iter().collect::>())) @@ -498,7 +498,7 @@ impl Ctx { fn lower_extern_crate( &mut self, - extern_crate: &ast::ExternCrateItem, + extern_crate: &ast::ExternCrate, ) -> Option> { let path = ModPath::from_name_ref(&extern_crate.name_ref()?); let alias = extern_crate.rename().map(|a| { -- cgit v1.2.3 From b1332670c7c471a59f3da113b366e74ac194c38b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:12:04 +0200 Subject: Rename UseItem -> Use --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 8a36de311..8bd0362dc 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -95,7 +95,7 @@ impl Ctx { ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} // These don't have inner items. - ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::UseItem(_) => {} + ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} }; let attrs = Attrs::new(item, &self.hygiene); @@ -110,7 +110,7 @@ impl Ctx { ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), - ast::Item::UseItem(ast) => Some(ModItems( + ast::Item::Use(ast) => Some(ModItems( self.lower_use(ast).into_iter().map(Into::into).collect::>(), )), ast::Item::ExternCrate(ast) => self.lower_extern_crate(ast).map(Into::into), @@ -469,7 +469,7 @@ impl Ctx { Some(id(self.data().impls.alloc(res))) } - fn lower_use(&mut self, use_item: &ast::UseItem) -> Vec> { + fn lower_use(&mut self, use_item: &ast::Use) -> Vec> { // FIXME: cfg_attr let is_prelude = use_item.has_atom_attr("prelude_import"); let visibility = self.lower_visibility(use_item); -- cgit v1.2.3 From 1142112c70b705f59b7d559d9d72cdc831865158 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 14:51:08 +0200 Subject: Rename FnDef -> Fn --- crates/ra_hir_def/src/item_tree/lower.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 8bd0362dc..2764d8674 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -78,7 +78,7 @@ impl Ctx { ast::Item::StructDef(_) | ast::Item::UnionDef(_) | ast::Item::EnumDef(_) - | ast::Item::FnDef(_) + | ast::Item::Fn(_) | ast::Item::TypeAliasDef(_) | ast::Item::ConstDef(_) | ast::Item::StaticDef(_) @@ -103,7 +103,7 @@ impl Ctx { ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), - ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into), + ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), @@ -155,7 +155,7 @@ impl Ctx { fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option { match item { - ast::AssocItem::FnDef(ast) => self.lower_function(ast).map(Into::into), + ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), @@ -277,7 +277,7 @@ impl Ctx { Some(res) } - fn lower_function(&mut self, func: &ast::FnDef) -> Option> { + fn lower_function(&mut self, func: &ast::Fn) -> Option> { let visibility = self.lower_visibility(func); let name = func.name()?.as_name(); @@ -547,7 +547,7 @@ impl Ctx { self.collect_inner_items(item.syntax()); let attrs = Attrs::new(&item, &self.hygiene); let id: ModItem = match item { - ast::ExternItem::FnDef(ast) => { + ast::ExternItem::Fn(ast) => { let func = self.lower_function(&ast)?; self.data().functions[func.index].is_unsafe = true; func.into() -- cgit v1.2.3 From eb2f8063444b11257111f4f8ade990ec810e0361 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:25:46 +0200 Subject: Rename TypeAliasDef -> TypeAlias --- crates/ra_hir_def/src/item_tree/lower.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 2764d8674..4cfc68f53 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -79,7 +79,7 @@ impl Ctx { | ast::Item::UnionDef(_) | ast::Item::EnumDef(_) | ast::Item::Fn(_) - | ast::Item::TypeAliasDef(_) + | ast::Item::TypeAlias(_) | ast::Item::ConstDef(_) | ast::Item::StaticDef(_) | ast::Item::MacroCall(_) => { @@ -104,7 +104,7 @@ impl Ctx { ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), - ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), @@ -156,7 +156,7 @@ impl Ctx { fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option { match item { ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), - ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), } @@ -348,7 +348,7 @@ impl Ctx { fn lower_type_alias( &mut self, - type_alias: &ast::TypeAliasDef, + type_alias: &ast::TypeAlias, ) -> Option> { let name = type_alias.name()?.as_name(); let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it)); -- cgit v1.2.3 From 28ef4c375a9f56d69daf885504aea3df7012bb81 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:36:21 +0200 Subject: Rename TypeParamList -> GenericParamList --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 4cfc68f53..19d165b5b 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -568,10 +568,10 @@ impl Ctx { fn lower_generic_params_and_inner_items( &mut self, owner: GenericsOwner<'_>, - node: &impl ast::TypeParamsOwner, + node: &impl ast::GenericParamsOwner, ) -> GenericParamsId { // Generics are part of item headers and may contain inner items we need to collect. - if let Some(params) = node.type_param_list() { + if let Some(params) = node.generic_param_list() { self.collect_inner_items(params.syntax()); } if let Some(clause) = node.where_clause() { @@ -584,7 +584,7 @@ impl Ctx { fn lower_generic_params( &mut self, owner: GenericsOwner<'_>, - node: &impl ast::TypeParamsOwner, + node: &impl ast::GenericParamsOwner, ) -> GenericParamsId { let mut sm = &mut ArenaMap::default(); let mut generics = GenericParams::default(); -- cgit v1.2.3 From 0a9e3ccc262fbcbd4cdaab30384f8cb71584544b Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 16:49:13 +0200 Subject: Rename FieldDef -> Field --- crates/ra_hir_def/src/item_tree/lower.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 19d165b5b..df909ee9e 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -1,10 +1,7 @@ //! AST -> `ItemTree` lowering code. -use super::*; -use crate::{ - attr::Attrs, - generics::{GenericParams, TypeParamData, TypeParamProvenance}, -}; +use std::{collections::hash_map::Entry, mem, sync::Arc}; + use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; use ra_arena::map::ArenaMap; use ra_syntax::{ @@ -12,7 +9,13 @@ use ra_syntax::{ SyntaxNode, }; use smallvec::SmallVec; -use std::{collections::hash_map::Entry, mem, sync::Arc}; + +use crate::{ + attr::Attrs, + generics::{GenericParams, TypeParamData, TypeParamProvenance}, +}; + +use super::*; fn id(index: Idx) -> FileItemTreeId { FileItemTreeId { index, _p: PhantomData } @@ -191,7 +194,7 @@ impl Ctx { } } - fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange { + fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange { let start = self.next_field_idx(); for field in fields.fields() { if let Some(data) = self.lower_record_field(&field) { @@ -203,7 +206,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option { + fn lower_record_field(&mut self, field: &ast::RecordField) -> Option { let name = field.name()?.as_name(); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.ascribed_type()); @@ -211,7 +214,7 @@ impl Ctx { Some(res) } - fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange { + fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange { let start = self.next_field_idx(); for (i, field) in fields.fields().enumerate() { let data = self.lower_tuple_field(i, &field); @@ -222,7 +225,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { + fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { let name = Name::new_tuple_field(idx); let visibility = self.lower_visibility(field); let type_ref = self.lower_type_ref_opt(field.type_ref()); @@ -234,10 +237,8 @@ impl Ctx { let visibility = self.lower_visibility(union); let name = union.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Union, union); - let fields = match union.record_field_def_list() { - Some(record_field_def_list) => { - self.lower_fields(&StructKind::Record(record_field_def_list)) - } + let fields = match union.record_field_list() { + Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)), None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), }; let ast_id = self.source_ast_id_map.ast_id(union); -- cgit v1.2.3 From 1ae4721c9cfea746fce59a816b1c266bf373d6cf Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:36:46 +0200 Subject: Finalize union grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index df909ee9e..2721a02a5 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -79,7 +79,7 @@ impl Ctx { // Collect inner items for 1-to-1-lowered items. match item { ast::Item::StructDef(_) - | ast::Item::UnionDef(_) + | ast::Item::Union(_) | ast::Item::EnumDef(_) | ast::Item::Fn(_) | ast::Item::TypeAlias(_) @@ -104,7 +104,7 @@ impl Ctx { let attrs = Attrs::new(item, &self.hygiene); let items = match item { ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), - ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), + ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), @@ -233,7 +233,7 @@ impl Ctx { res } - fn lower_union(&mut self, union: &ast::UnionDef) -> Option> { + fn lower_union(&mut self, union: &ast::Union) -> Option> { let visibility = self.lower_visibility(union); let name = union.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Union, union); -- cgit v1.2.3 From 216a5344c8ef3c3e430d2761dc8b1a7b60250a15 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:50:40 +0200 Subject: Rename StructDef -> Struct --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 2721a02a5..a85618015 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -78,7 +78,7 @@ impl Ctx { // Collect inner items for 1-to-1-lowered items. match item { - ast::Item::StructDef(_) + ast::Item::Struct(_) | ast::Item::Union(_) | ast::Item::EnumDef(_) | ast::Item::Fn(_) @@ -103,7 +103,7 @@ impl Ctx { let attrs = Attrs::new(item, &self.hygiene); let items = match item { - ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), + ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into), ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), @@ -165,7 +165,7 @@ impl Ctx { } } - fn lower_struct(&mut self, strukt: &ast::StructDef) -> Option> { + fn lower_struct(&mut self, strukt: &ast::Struct) -> Option> { let visibility = self.lower_visibility(strukt); let name = strukt.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Struct, strukt); -- cgit v1.2.3 From 609680ef97dbf82c07b6b06e21aa366423892304 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:52:53 +0200 Subject: Rename EnumDef -> Enum --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index a85618015..da7238416 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -80,7 +80,7 @@ impl Ctx { match item { ast::Item::Struct(_) | ast::Item::Union(_) - | ast::Item::EnumDef(_) + | ast::Item::Enum(_) | ast::Item::Fn(_) | ast::Item::TypeAlias(_) | ast::Item::ConstDef(_) @@ -105,7 +105,7 @@ impl Ctx { let items = match item { ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into), ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), - ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), + ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), @@ -246,7 +246,7 @@ impl Ctx { Some(id(self.data().unions.alloc(res))) } - fn lower_enum(&mut self, enum_: &ast::EnumDef) -> Option> { + fn lower_enum(&mut self, enum_: &ast::Enum) -> Option> { let visibility = self.lower_visibility(enum_); let name = enum_.name()?.as_name(); let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); -- cgit v1.2.3 From 1766aae145c6925a33e427f2fe6ef2a56c301665 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 17:56:53 +0200 Subject: Rename EnumVariant -> Variant --- crates/ra_hir_def/src/item_tree/lower.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index da7238416..6d963c852 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -259,7 +259,7 @@ impl Ctx { Some(id(self.data().enums.alloc(res))) } - fn lower_variants(&mut self, variants: &ast::EnumVariantList) -> IdRange { + fn lower_variants(&mut self, variants: &ast::VariantList) -> IdRange { let start = self.next_variant_idx(); for variant in variants.variants() { if let Some(data) = self.lower_variant(&variant) { @@ -271,7 +271,7 @@ impl Ctx { IdRange::new(start..end) } - fn lower_variant(&mut self, variant: &ast::EnumVariant) -> Option { + fn lower_variant(&mut self, variant: &ast::Variant) -> Option { let name = variant.name()?.as_name(); let fields = self.lower_fields(&variant.kind()); let res = Variant { name, fields }; -- cgit v1.2.3 From 3cd4112bdc924c132cb0eab9d064511a215421ec Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:02:20 +0200 Subject: Finalize const&static grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 6d963c852..a94548e5d 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -83,8 +83,8 @@ impl Ctx { | ast::Item::Enum(_) | ast::Item::Fn(_) | ast::Item::TypeAlias(_) - | ast::Item::ConstDef(_) - | ast::Item::StaticDef(_) + | ast::Item::Const(_) + | ast::Item::Static(_) | ast::Item::MacroCall(_) => { // Skip this if we're already collecting inner items. We'll descend into all nodes // already. @@ -108,8 +108,8 @@ impl Ctx { ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), - ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), - ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), + ast::Item::Static(ast) => self.lower_static(ast).map(Into::into), + ast::Item::Const(ast) => Some(self.lower_const(ast).into()), ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), @@ -160,7 +160,7 @@ impl Ctx { match item { ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), - ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), + ast::AssocItem::Const(ast) => Some(self.lower_const(ast).into()), ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), } } @@ -368,7 +368,7 @@ impl Ctx { Some(id(self.data().type_aliases.alloc(res))) } - fn lower_static(&mut self, static_: &ast::StaticDef) -> Option> { + fn lower_static(&mut self, static_: &ast::Static) -> Option> { let name = static_.name()?.as_name(); let type_ref = self.lower_type_ref_opt(static_.ascribed_type()); let visibility = self.lower_visibility(static_); @@ -378,7 +378,7 @@ impl Ctx { Some(id(self.data().statics.alloc(res))) } - fn lower_const(&mut self, konst: &ast::ConstDef) -> FileItemTreeId { + fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId { let name = konst.name().map(|it| it.as_name()); let type_ref = self.lower_type_ref_opt(konst.ascribed_type()); let visibility = self.lower_visibility(konst); @@ -553,7 +553,7 @@ impl Ctx { self.data().functions[func.index].is_unsafe = true; func.into() } - ast::ExternItem::StaticDef(ast) => { + ast::ExternItem::Static(ast) => { let statik = self.lower_static(&ast)?; statik.into() } -- cgit v1.2.3 From c83467796b6c7365ea4f41900d74444384a9e618 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:17:28 +0200 Subject: Finalize Trait grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index a94548e5d..aaf3cfd3a 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -95,7 +95,7 @@ impl Ctx { // These are handled in their respective `lower_X` method (since we can't just blindly // walk them). - ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} + ast::Item::Trait(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} // These don't have inner items. ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} @@ -111,7 +111,7 @@ impl Ctx { ast::Item::Static(ast) => self.lower_static(ast).map(Into::into), ast::Item::Const(ast) => Some(self.lower_const(ast).into()), ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), - ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), + ast::Item::Trait(ast) => self.lower_trait(ast).map(Into::into), ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), ast::Item::Use(ast) => Some(ModItems( self.lower_use(ast).into_iter().map(Into::into).collect::>(), @@ -413,7 +413,7 @@ impl Ctx { Some(id(self.data().mods.alloc(res))) } - fn lower_trait(&mut self, trait_def: &ast::TraitDef) -> Option> { + fn lower_trait(&mut self, trait_def: &ast::Trait) -> Option> { let name = trait_def.name()?.as_name(); let visibility = self.lower_visibility(trait_def); let generic_params = @@ -698,7 +698,7 @@ enum GenericsOwner<'a> { Enum, Union, /// The `TraitDef` is needed to fill the source map for the implicit `Self` parameter. - Trait(&'a ast::TraitDef), + Trait(&'a ast::Trait), TypeAlias, Impl, } -- cgit v1.2.3 From c5798c4d75aa807aec47208a49101bdec3affcca Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:28:28 +0200 Subject: Finalize impl Grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index aaf3cfd3a..b0cf94956 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -95,7 +95,7 @@ impl Ctx { // These are handled in their respective `lower_X` method (since we can't just blindly // walk them). - ast::Item::Trait(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} + ast::Item::Trait(_) | ast::Item::Impl(_) | ast::Item::ExternBlock(_) => {} // These don't have inner items. ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} @@ -112,7 +112,7 @@ impl Ctx { ast::Item::Const(ast) => Some(self.lower_const(ast).into()), ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), ast::Item::Trait(ast) => self.lower_trait(ast).map(Into::into), - ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), + ast::Item::Impl(ast) => self.lower_impl(ast).map(Into::into), ast::Item::Use(ast) => Some(ModItems( self.lower_use(ast).into_iter().map(Into::into).collect::>(), )), @@ -445,7 +445,7 @@ impl Ctx { Some(id(self.data().traits.alloc(res))) } - fn lower_impl(&mut self, impl_def: &ast::ImplDef) -> Option> { + fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option> { let generic_params = self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); -- cgit v1.2.3 From 917c89c103597d09e95bdee273633f79123dd19e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 18:37:46 +0200 Subject: Finaize item grammar --- crates/ra_hir_def/src/item_tree/lower.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index b0cf94956..29f1de547 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -557,6 +557,7 @@ impl Ctx { let statik = self.lower_static(&ast)?; statik.into() } + ast::ExternItem::MacroCall(_) => return None, }; self.add_attrs(id.into(), attrs); Some(id) -- cgit v1.2.3 From 2e2642efccd5855e4158b01a006e7884a96982bb Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 20:51:43 +0200 Subject: Remove TypeAscriptionOwner --- crates/ra_hir_def/src/item_tree/lower.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 29f1de547..f0ced1f79 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -209,7 +209,7 @@ impl Ctx { fn lower_record_field(&mut self, field: &ast::RecordField) -> Option { let name = field.name()?.as_name(); let visibility = self.lower_visibility(field); - let type_ref = self.lower_type_ref_opt(field.ascribed_type()); + let type_ref = self.lower_type_ref_opt(field.ty()); let res = Field { name, type_ref, visibility }; Some(res) } @@ -286,7 +286,7 @@ impl Ctx { let mut has_self_param = false; if let Some(param_list) = func.param_list() { if let Some(self_param) = param_list.self_param() { - let self_type = match self_param.ascribed_type() { + let self_type = match self_param.ty() { Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), None => { let self_type = TypeRef::Path(name![Self].into()); @@ -305,7 +305,7 @@ impl Ctx { has_self_param = true; } for param in param_list.params() { - let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ascribed_type()); + let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ty()); params.push(type_ref); } } @@ -370,7 +370,7 @@ impl Ctx { fn lower_static(&mut self, static_: &ast::Static) -> Option> { let name = static_.name()?.as_name(); - let type_ref = self.lower_type_ref_opt(static_.ascribed_type()); + let type_ref = self.lower_type_ref_opt(static_.ty()); let visibility = self.lower_visibility(static_); let mutable = static_.mut_token().is_some(); let ast_id = self.source_ast_id_map.ast_id(static_); @@ -380,7 +380,7 @@ impl Ctx { fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId { let name = konst.name().map(|it| it.as_name()); - let type_ref = self.lower_type_ref_opt(konst.ascribed_type()); + let type_ref = self.lower_type_ref_opt(konst.ty()); let visibility = self.lower_visibility(konst); let ast_id = self.source_ast_id_map.ast_id(konst); let res = Const { name, visibility, type_ref, ast_id }; -- cgit v1.2.3 From f95f425ae4199e814e6956be1d9bb59a14758c07 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 21:02:55 +0200 Subject: Use ty to access most TypeRefs --- crates/ra_hir_def/src/item_tree/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index f0ced1f79..feb31579e 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -228,7 +228,7 @@ impl Ctx { fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { let name = Name::new_tuple_field(idx); let visibility = self.lower_visibility(field); - let type_ref = self.lower_type_ref_opt(field.type_ref()); + let type_ref = self.lower_type_ref_opt(field.ty()); let res = Field { name, type_ref, visibility }; res } @@ -317,7 +317,7 @@ impl Ctx { } } - let ret_type = match func.ret_type().and_then(|rt| rt.type_ref()) { + let ret_type = match func.ret_type().and_then(|rt| rt.ty()) { Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), _ => TypeRef::unit(), }; @@ -352,7 +352,7 @@ impl Ctx { type_alias: &ast::TypeAlias, ) -> Option> { let name = type_alias.name()?.as_name(); - let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it)); + let type_ref = type_alias.ty().map(|it| self.lower_type_ref(&it)); let visibility = self.lower_visibility(type_alias); let bounds = self.lower_type_bounds(type_alias); let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias); -- cgit v1.2.3 From 08ea2271e8050165d0aaf4c994ed3dd746aff3ba Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 12:06:38 +0200 Subject: Rename TypeRef -> Type The TypeRef name comes from IntelliJ days, where you often have both type *syntax* as well as *semantical* representation of types in scope. And naming both Type is confusing. In rust-analyzer however, we use ast types as `ast::Type`, and have many more semantic counterparts to ast types, so avoiding name clash here is just confusing. --- crates/ra_hir_def/src/item_tree/lower.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index feb31579e..b5d416acb 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -648,10 +648,10 @@ impl Ctx { self.data().vis.alloc(vis) } - fn lower_type_ref(&self, type_ref: &ast::TypeRef) -> TypeRef { + fn lower_type_ref(&self, type_ref: &ast::Type) -> TypeRef { TypeRef::from_ast(&self.body_ctx, type_ref.clone()) } - fn lower_type_ref_opt(&self, type_ref: Option) -> TypeRef { + fn lower_type_ref_opt(&self, type_ref: Option) -> TypeRef { type_ref.map(|ty| self.lower_type_ref(&ty)).unwrap_or(TypeRef::Error) } -- cgit v1.2.3 From af53d5f4b081ad50d8fe08fc1e107aa6025b2491 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 20:23:52 +0200 Subject: Rename --- crates/ra_hir_def/src/item_tree/lower.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_hir_def/src/item_tree/lower.rs') diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index b5d416acb..450ef8798 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -448,8 +448,8 @@ impl Ctx { fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option> { let generic_params = self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); - let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); - let target_type = self.lower_type_ref(&impl_def.target_type()?); + let target_trait = impl_def.trait_().map(|tr| self.lower_type_ref(&tr)); + let target_type = self.lower_type_ref(&impl_def.self_ty()?); let is_negative = impl_def.excl_token().is_some(); // We cannot use `assoc_items()` here as that does not include macro calls. -- cgit v1.2.3