]> git.lizzy.rs Git - rust.git/commitdiff
Rename ast::ImplBlock -> ast::ImplDef
authorAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 29 Feb 2020 20:24:40 +0000 (21:24 +0100)
committerAleksey Kladov <aleksey.kladov@gmail.com>
Sat, 29 Feb 2020 20:33:15 +0000 (21:33 +0100)
72 files changed:
crates/ra_assists/src/ast_transform.rs
crates/ra_assists/src/handlers/add_missing_impl_members.rs
crates/ra_assists/src/handlers/add_new.rs
crates/ra_assists/src/handlers/move_bounds.rs
crates/ra_assists/src/utils.rs
crates/ra_hir/src/code_model.rs
crates/ra_hir/src/from_id.rs
crates/ra_hir/src/has_source.rs
crates/ra_hir/src/lib.rs
crates/ra_hir/src/semantics.rs
crates/ra_hir/src/semantics/source_to_def.rs
crates/ra_hir/src/source_analyzer.rs
crates/ra_hir_def/src/body/lower.rs
crates/ra_hir_def/src/data.rs
crates/ra_hir_def/src/keys.rs
crates/ra_hir_def/src/lang_item.rs
crates/ra_hir_def/src/lib.rs
crates/ra_hir_def/src/nameres/raw.rs
crates/ra_hir_def/src/resolver.rs
crates/ra_hir_ty/src/db.rs
crates/ra_hir_ty/src/method_resolution.rs
crates/ra_hir_ty/src/tests/macros.rs
crates/ra_hir_ty/src/traits.rs
crates/ra_hir_ty/src/traits/builtin.rs
crates/ra_hir_ty/src/traits/chalk.rs
crates/ra_ide/src/completion/complete_trait_impl.rs
crates/ra_ide/src/completion/completion_context.rs
crates/ra_ide/src/display/navigation_target.rs
crates/ra_ide/src/display/structure.rs
crates/ra_ide/src/expand_macro.rs
crates/ra_ide/src/goto_definition.rs
crates/ra_ide/src/impls.rs
crates/ra_ide/src/references/classify.rs
crates/ra_ide_db/src/defs.rs
crates/ra_parser/src/grammar.rs
crates/ra_parser/src/grammar/items.rs
crates/ra_parser/src/grammar/items/traits.rs
crates/ra_parser/src/syntax_kind/generated.rs
crates/ra_syntax/src/ast/extensions.rs
crates/ra_syntax/src/ast/generated.rs
crates/ra_syntax/src/validation.rs
crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt
crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt
crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt
crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt
crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt
crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt
crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt
crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt
crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt
crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt
crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.rs [deleted file]
crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.txt [deleted file]
crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs [new file with mode: 0644]
crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.txt [new file with mode: 0644]
crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.rs [deleted file]
crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.txt [deleted file]
crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rs [new file with mode: 0644]
crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.txt [new file with mode: 0644]
crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt
crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt
crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt
crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt
crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt
crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt
crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt
crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt
crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
crates/rust-analyzer/src/cli/analysis_stats.rs
crates/rust-analyzer/src/conv.rs
xtask/src/ast_src.rs

index a74ac42d5d229431d0a6dd2a29f44c841231efe1..0e53c1eee81c776a00ec53a5b048c675001828d4 100644 (file)
@@ -40,9 +40,9 @@ pub fn for_trait_impl(
         db: &'a RootDatabase,
         // FIXME: there's implicit invariant that `trait_` and  `source_scope` match...
         trait_: hir::Trait,
-        impl_block: ast::ImplBlock,
+        impl_def: ast::ImplDef,
     ) -> SubstituteTypeParams<'a> {
-        let substs = get_syntactic_substs(impl_block).unwrap_or_default();
+        let substs = get_syntactic_substs(impl_def).unwrap_or_default();
         let generic_def: hir::GenericDef = trait_.into();
         let substs_by_param: FxHashMap<_, _> = generic_def
             .params(db)
@@ -59,8 +59,8 @@ pub fn for_trait_impl(
 
         // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
         // trait ref, and then go from the types in the substs back to the syntax)
-        fn get_syntactic_substs(impl_block: ast::ImplBlock) -> Option<Vec<ast::TypeRef>> {
-            let target_trait = impl_block.target_trait()?;
+        fn get_syntactic_substs(impl_def: ast::ImplDef) -> Option<Vec<ast::TypeRef>> {
+            let target_trait = impl_def.target_trait()?;
             let path_type = match target_trait {
                 ast::TypeRef::PathType(path) => path,
                 _ => return None,
index 4005014bdf3ff4f719167fafca7215b04c4ee39b..639180d37c6fb3a3f164a94832355ecb2ed9eaed 100644 (file)
@@ -101,7 +101,7 @@ fn add_missing_impl_members_inner(
     label: &'static str,
 ) -> Option<Assist> {
     let _p = ra_prof::profile("add_missing_impl_members_inner");
-    let impl_node = ctx.find_node_at_offset::<ast::ImplBlock>()?;
+    let impl_node = ctx.find_node_at_offset::<ast::ImplDef>()?;
     let impl_item_list = impl_node.item_list()?;
 
     let trait_ = resolve_target_trait(&ctx.sema, &impl_node)?;
@@ -257,7 +257,7 @@ fn bar(&self) {}
     }
 
     #[test]
-    fn test_empty_impl_block() {
+    fn test_empty_impl_def() {
         check_assist(
             add_missing_impl_members,
             "
@@ -308,7 +308,7 @@ impl<U> Foo<U> for S {
     }
 
     #[test]
-    fn test_cursor_after_empty_impl_block() {
+    fn test_cursor_after_empty_impl_def() {
         check_assist(
             add_missing_impl_members,
             "
index 166e907fb40e0f10800b62cd3589006ef7083674..697e7cda65afc0dcf3122769a16cdf2f025ef767 100644 (file)
@@ -41,14 +41,14 @@ pub(crate) fn add_new(ctx: AssistCtx) -> Option<Assist> {
     };
 
     // Return early if we've found an existing new fn
-    let impl_block = find_struct_impl(&ctx, &strukt)?;
+    let impl_def = find_struct_impl(&ctx, &strukt)?;
 
     ctx.add_assist(AssistId("add_new"), "Add default constructor", |edit| {
         edit.target(strukt.syntax().text_range());
 
         let mut buf = String::with_capacity(512);
 
-        if impl_block.is_some() {
+        if impl_def.is_some() {
             buf.push('\n');
         }
 
@@ -71,10 +71,10 @@ pub(crate) fn add_new(ctx: AssistCtx) -> Option<Assist> {
 
         buf.push_str("} }");
 
-        let (start_offset, end_offset) = impl_block
-            .and_then(|impl_block| {
+        let (start_offset, end_offset) = impl_def
+            .and_then(|impl_def| {
                 buf.push('\n');
-                let start = impl_block
+                let start = impl_def
                     .syntax()
                     .descendants_with_tokens()
                     .find(|t| t.kind() == T!['{'])?
@@ -128,7 +128,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String {
 //
 // FIXME: change the new fn checking to a more semantic approach when that's more
 // viable (e.g. we process proc macros, etc)
-fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<ast::ImplBlock>> {
+fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<ast::ImplDef>> {
     let db = ctx.db;
     let module = strukt.syntax().ancestors().find(|node| {
         ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind())
@@ -136,7 +136,7 @@ fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<a
 
     let struct_def = ctx.sema.to_def(strukt)?;
 
-    let block = module.descendants().filter_map(ast::ImplBlock::cast).find_map(|impl_blk| {
+    let block = module.descendants().filter_map(ast::ImplDef::cast).find_map(|impl_blk| {
         let blk = ctx.sema.to_def(&impl_blk)?;
 
         // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}`
@@ -164,7 +164,7 @@ fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<a
     Some(block)
 }
 
-fn has_new_fn(imp: &ast::ImplBlock) -> bool {
+fn has_new_fn(imp: &ast::ImplDef) -> bool {
     if let Some(il) = imp.item_list() {
         for item in il.impl_items() {
             if let ast::ImplItem::FnDef(f) = item {
index 86b2353660b722ac8a72805aaa8eb1f0a080e58e..0b501f3e583db373df5e7fcac8f8a1bd89fe8d4a 100644 (file)
@@ -37,7 +37,7 @@ pub(crate) fn move_bounds_to_where_clause(ctx: AssistCtx) -> Option<Assist> {
     let anchor: SyntaxElement = match parent.kind() {
         FN_DEF => ast::FnDef::cast(parent)?.body()?.syntax().clone().into(),
         TRAIT_DEF => ast::TraitDef::cast(parent)?.item_list()?.syntax().clone().into(),
-        IMPL_BLOCK => ast::ImplBlock::cast(parent)?.item_list()?.syntax().clone().into(),
+        IMPL_DEF => ast::ImplDef::cast(parent)?.item_list()?.syntax().clone().into(),
         ENUM_DEF => ast::EnumDef::cast(parent)?.variant_list()?.syntax().clone().into(),
         STRUCT_DEF => parent
             .children_with_tokens()
index d544caee7b159f40344ea507b1827e65e47eefc9..3d6c59bda91db0b076f21007442111b340071ed1 100644 (file)
 
 pub fn get_missing_impl_items(
     sema: &Semantics<RootDatabase>,
-    impl_block: &ast::ImplBlock,
+    impl_def: &ast::ImplDef,
 ) -> Vec<hir::AssocItem> {
     // Names must be unique between constants and functions. However, type aliases
     // may share the same name as a function or constant.
     let mut impl_fns_consts = FxHashSet::default();
     let mut impl_type = FxHashSet::default();
 
-    if let Some(item_list) = impl_block.item_list() {
+    if let Some(item_list) = impl_def.item_list() {
         for item in item_list.impl_items() {
             match item {
                 ast::ImplItem::FnDef(f) => {
@@ -44,7 +44,7 @@ pub fn get_missing_impl_items(
         }
     }
 
-    resolve_target_trait(sema, impl_block).map_or(vec![], |target_trait| {
+    resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| {
         target_trait
             .items(sema.db)
             .iter()
@@ -65,9 +65,9 @@ pub fn get_missing_impl_items(
 
 pub(crate) fn resolve_target_trait(
     sema: &Semantics<RootDatabase>,
-    impl_block: &ast::ImplBlock,
+    impl_def: &ast::ImplDef,
 ) -> Option<hir::Trait> {
-    let ast_path = impl_block
+    let ast_path = impl_def
         .target_trait()
         .map(|it| it.syntax().clone())
         .and_then(ast::PathType::cast)?
index 034fb7cfa52e0f75d05208004a99902c33909ac5..b71ee764ac37646c2c8dad94409a818cede09547 100644 (file)
@@ -229,8 +229,8 @@ pub fn diagnostics(self, db: &impl HirDatabase, sink: &mut DiagnosticSink) {
             }
         }
 
-        for impl_block in self.impl_blocks(db) {
-            for item in impl_block.items(db) {
+        for impl_def in self.impl_defs(db) {
+            for item in impl_def.items(db) {
                 if let AssocItem::Function(f) = item {
                     f.diagnostics(db, sink);
                 }
@@ -243,9 +243,9 @@ pub fn declarations(self, db: &impl DefDatabase) -> Vec<ModuleDef> {
         def_map[self.id.local_id].scope.declarations().map(ModuleDef::from).collect()
     }
 
-    pub fn impl_blocks(self, db: &impl DefDatabase) -> Vec<ImplBlock> {
+    pub fn impl_defs(self, db: &impl DefDatabase) -> Vec<ImplDef> {
         let def_map = db.crate_def_map(self.id.krate);
-        def_map[self.id.local_id].scope.impls().map(ImplBlock::from).collect()
+        def_map[self.id.local_id].scope.impls().map(ImplDef::from).collect()
     }
 
     pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module {
@@ -686,7 +686,7 @@ pub enum AssocItem {
 }
 pub enum AssocItemContainer {
     Trait(Trait),
-    ImplBlock(ImplBlock),
+    ImplDef(ImplDef),
 }
 pub trait AsAssocItem {
     fn as_assoc_item(self, db: &impl DefDatabase) -> Option<AssocItem>;
@@ -736,7 +736,7 @@ pub fn container(self, db: &impl DefDatabase) -> AssocItemContainer {
         };
         match container {
             AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()),
-            AssocContainerId::ImplId(id) => AssocItemContainer::ImplBlock(id.into()),
+            AssocContainerId::ImplId(id) => AssocItemContainer::ImplDef(id.into()),
             AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"),
         }
     }
@@ -748,7 +748,7 @@ pub enum GenericDef {
     Adt(Adt),
     Trait(Trait),
     TypeAlias(TypeAlias),
-    ImplBlock(ImplBlock),
+    ImplDef(ImplDef),
     // enum variants cannot have generics themselves, but their parent enums
     // can, and this makes some code easier to write
     EnumVariant(EnumVariant),
@@ -760,7 +760,7 @@ pub enum GenericDef {
     Adt(Struct, Enum, Union),
     Trait,
     TypeAlias,
-    ImplBlock,
+    ImplDef,
     EnumVariant,
     Const
 );
@@ -850,20 +850,20 @@ pub fn module(self, db: &impl HirDatabase) -> Module {
     }
 }
 
-// FIXME: rename from `ImplBlock` to `Impl`
+// FIXME: rename from `ImplDef` to `Impl`
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
-pub struct ImplBlock {
+pub struct ImplDef {
     pub(crate) id: ImplId,
 }
 
-impl ImplBlock {
-    pub fn all_in_crate(db: &impl HirDatabase, krate: Crate) -> Vec<ImplBlock> {
+impl ImplDef {
+    pub fn all_in_crate(db: &impl HirDatabase, krate: Crate) -> Vec<ImplDef> {
         let impls = db.impls_in_crate(krate.id);
         impls.all_impls().map(Self::from).collect()
     }
-    pub fn for_trait(db: &impl HirDatabase, krate: Crate, trait_: Trait) -> Vec<ImplBlock> {
+    pub fn for_trait(db: &impl HirDatabase, krate: Crate, trait_: Trait) -> Vec<ImplDef> {
         let impls = db.impls_in_crate(krate.id);
-        impls.lookup_impl_blocks_for_trait(trait_.id).map(Self::from).collect()
+        impls.lookup_impl_defs_for_trait(trait_.id).map(Self::from).collect()
     }
 
     pub fn target_trait(&self, db: &impl DefDatabase) -> Option<TypeRef> {
@@ -1077,7 +1077,7 @@ pub fn autoderef<'a>(&'a self, db: &'a impl HirDatabase) -> impl Iterator<Item =
     }
 
     // This would be nicer if it just returned an iterator, but that runs into
-    // lifetime problems, because we need to borrow temp `CrateImplBlocks`.
+    // lifetime problems, because we need to borrow temp `CrateImplDefs`.
     pub fn iterate_impl_items<T>(
         self,
         db: &impl HirDatabase,
@@ -1087,8 +1087,8 @@ pub fn iterate_impl_items<T>(
         for krate in self.ty.value.def_crates(db, krate.id)? {
             let impls = db.impls_in_crate(krate);
 
-            for impl_block in impls.lookup_impl_blocks(&self.ty.value) {
-                for &item in db.impl_data(impl_block).items.iter() {
+            for impl_def in impls.lookup_impl_defs(&self.ty.value) {
+                for &item in db.impl_data(impl_def).items.iter() {
                     if let Some(result) = callback(item.into()) {
                         return Some(result);
                     }
@@ -1196,7 +1196,7 @@ pub enum ScopeDef {
     ModuleDef(ModuleDef),
     MacroDef(MacroDef),
     GenericParam(TypeParam),
-    ImplSelfType(ImplBlock),
+    ImplSelfType(ImplDef),
     AdtSelfType(Adt),
     Local(Local),
     Unknown,
index cbfa91d6c7b08ed1cb25f4fa90cd4ec97f8dc304..c179b13c6bff480b277a5dba6ce238a95e34d9a0 100644 (file)
@@ -39,7 +39,7 @@ fn from(ty: $ty) -> $id {
     (hir_def::StaticId, crate::Static),
     (hir_def::ConstId, crate::Const),
     (hir_def::FunctionId, crate::Function),
-    (hir_def::ImplId, crate::ImplBlock),
+    (hir_def::ImplId, crate::ImplDef),
     (hir_def::TypeParamId, crate::TypeParam),
     (hir_expand::MacroDefId, crate::MacroDef)
 ];
@@ -145,7 +145,7 @@ fn from(def: GenericDef) -> Self {
             GenericDef::Adt(it) => GenericDefId::AdtId(it.into()),
             GenericDef::Trait(it) => GenericDefId::TraitId(it.id),
             GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id),
-            GenericDef::ImplBlock(it) => GenericDefId::ImplId(it.id),
+            GenericDef::ImplDef(it) => GenericDefId::ImplId(it.id),
             GenericDef::EnumVariant(it) => {
                 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id })
             }
index 5541266e2b1e0f534909313d9d630ee7c1b71087..f121e1effc9b03764863c925f031adfc45a9b30b 100644 (file)
@@ -9,7 +9,7 @@
 use ra_syntax::ast;
 
 use crate::{
-    db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, ImplBlock, MacroDef, Module,
+    db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, ImplDef, MacroDef, Module,
     Static, Struct, StructField, Trait, TypeAlias, TypeParam, Union,
 };
 
@@ -111,9 +111,9 @@ fn source(self, db: &impl DefDatabase) -> InFile<ast::MacroCall> {
         }
     }
 }
-impl HasSource for ImplBlock {
-    type Ast = ast::ImplBlock;
-    fn source(self, db: &impl DefDatabase) -> InFile<ast::ImplBlock> {
+impl HasSource for ImplDef {
+    type Ast = ast::ImplDef;
+    fn source(self, db: &impl DefDatabase) -> InFile<ast::ImplDef> {
         self.id.lookup(db).source(db)
     }
 }
index cefbd80e6b366756cab3606bdaf5c327e5500b3f..e1cb12cca06818b423d8ae923cb0c463e717c19f 100644 (file)
@@ -41,7 +41,7 @@ fn from(it: $sv) -> $e {
     code_model::{
         Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency,
         DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs,
-        HasVisibility, ImplBlock, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct,
+        HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct,
         StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
     },
     has_source::HasSource,
index 74901e318a5ef9796a5eaf17989d85a2088af5fd..a0853957c1beb81573153ae538112a2c0649dced 100644 (file)
@@ -262,7 +262,7 @@ fn to_def<DB: HirDatabase>(sema: &Semantics<DB>, src: InFile<Self>) -> Option<Se
     (crate::Enum, ast::EnumDef, enum_to_def),
     (crate::Union, ast::UnionDef, union_to_def),
     (crate::Trait, ast::TraitDef, trait_to_def),
-    (crate::ImplBlock, ast::ImplBlock, impl_to_def),
+    (crate::ImplDef, ast::ImplDef, impl_to_def),
     (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def),
     (crate::Const, ast::ConstDef, const_to_def),
     (crate::Static, ast::StaticDef, static_to_def),
index 884b535b2919a559b155aaf66f71d139488f2360..67b243222de2045f2f43f10e94e9ecb56947c2de 100644 (file)
@@ -67,7 +67,7 @@ pub(super) fn module_to_def(&mut self, src: InFile<ast::Module>) -> Option<Modul
     pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> {
         self.to_def(src, keys::TRAIT)
     }
-    pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplBlock>) -> Option<ImplId> {
+    pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> {
         self.to_def(src, keys::IMPL)
     }
     pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> {
@@ -166,7 +166,7 @@ pub(super) fn find_container(&mut self, src: InFile<&SyntaxNode>) -> Option<Chil
                         let def = self.trait_to_def(container.with_value(it))?;
                         def.into()
                     },
-                    ast::ImplBlock(it) => {
+                    ast::ImplDef(it) => {
                         let def = self.impl_to_def(container.with_value(it))?;
                         def.into()
                     },
@@ -213,7 +213,7 @@ fn find_type_param_container(&mut self, src: InFile<&SyntaxNode>) -> Option<Gene
                     ast::EnumDef(it) => { self.enum_to_def(container.with_value(it))?.into() },
                     ast::TraitDef(it) => { self.trait_to_def(container.with_value(it))?.into() },
                     ast::TypeAliasDef(it) => { self.type_alias_to_def(container.with_value(it))?.into() },
-                    ast::ImplBlock(it) => { self.impl_to_def(container.with_value(it))?.into() },
+                    ast::ImplDef(it) => { self.impl_to_def(container.with_value(it))?.into() },
                     _ => continue,
                 }
             };
index c650a9e08fb96bce2785d3009937c4994bf8ea04..4c121eb73923f979f07c2251eabbe5a8f2edf9ab 100644 (file)
@@ -49,7 +49,7 @@ pub enum PathResolution {
     Local(Local),
     /// A generic parameter
     TypeParam(TypeParam),
-    SelfType(crate::ImplBlock),
+    SelfType(crate::ImplDef),
     Macro(MacroDef),
     AssocItem(crate::AssocItem),
 }
index b3fb6d452aa623edf28913c2aea9f3a9473ecbf0..c18e6879bae958502a1748956e6e59c6d408d8d8 100644 (file)
@@ -544,7 +544,7 @@ fn collect_block_items(&mut self, block: &ast::Block) {
                     let ast_id = self.expander.ast_id(&def);
                     (TraitLoc { container, ast_id }.intern(self.db).into(), def.name())
                 }
-                ast::ModuleItem::ImplBlock(_)
+                ast::ModuleItem::ImplDef(_)
                 | ast::ModuleItem::UseItem(_)
                 | ast::ModuleItem::ExternCrateItem(_)
                 | ast::ModuleItem::Module(_) => continue,
index c900a6a183acf8c1eddc2cebc26decd069441012..c5fb9428e709c27630d75418e66b17f6e4f2567d 100644 (file)
@@ -238,16 +238,16 @@ fn new<N: NameOwner + TypeAscriptionOwner>(node: &N) -> ConstData {
 fn collect_impl_items_in_macros(
     db: &impl DefDatabase,
     module_id: ModuleId,
-    impl_block: &InFile<ast::ItemList>,
+    impl_def: &InFile<ast::ItemList>,
     id: ImplId,
 ) -> Vec<AssocItemId> {
-    let mut expander = Expander::new(db, impl_block.file_id, module_id);
+    let mut expander = Expander::new(db, impl_def.file_id, module_id);
     let mut res = Vec::new();
 
     // We set a limit to protect against infinite recursion
     let limit = 100;
 
-    for m in impl_block.value.syntax().children().filter_map(ast::MacroCall::cast) {
+    for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) {
         res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit))
     }
 
index 5913f12b16fdea9486a6a57d6f667a4a0d5e9a97..8cd70eb9a3fe997aa240be6c2eb51c4023c0ba13 100644 (file)
@@ -18,7 +18,7 @@
 pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
 pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
 pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new();
-pub const IMPL: Key<ast::ImplBlock, ImplId> = Key::new();
+pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
 pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
 pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
 pub const UNION: Key<ast::UnionDef, UnionId> = Key::new();
index 37c861a877b1c6c25b825389c12243f53a1e6a28..5a336ea1f175f292e240818d9dc9467aa5b4125c 100644 (file)
@@ -16,7 +16,7 @@
 pub enum LangItemTarget {
     EnumId(EnumId),
     FunctionId(FunctionId),
-    ImplBlockId(ImplId),
+    ImplDefId(ImplId),
     StaticId(StaticId),
     StructId(StructId),
     TraitId(TraitId),
@@ -37,9 +37,9 @@ pub fn as_function(self) -> Option<FunctionId> {
         }
     }
 
-    pub fn as_impl_block(self) -> Option<ImplId> {
+    pub fn as_impl_def(self) -> Option<ImplId> {
         match self {
-            LangItemTarget::ImplBlockId(id) => Some(id),
+            LangItemTarget::ImplDefId(id) => Some(id),
             _ => None,
         }
     }
@@ -125,8 +125,8 @@ fn collect_lang_items(&mut self, db: &impl DefDatabase, module: ModuleId) {
         // Look for impl targets
         let def_map = db.crate_def_map(module.krate);
         let module_data = &def_map[module.local_id];
-        for impl_block in module_data.scope.impls() {
-            self.collect_lang_item(db, impl_block, LangItemTarget::ImplBlockId)
+        for impl_def in module_data.scope.impls() {
+            self.collect_lang_item(db, impl_def, LangItemTarget::ImplDefId)
         }
 
         for def in module_data.scope.declarations() {
index 564b5fec5760ee877a2bf77c7ea99f4e4e4744d0..c9b14d0c80e78fa51a18f8cb4387e83b8f08aa4c 100644 (file)
@@ -164,7 +164,7 @@ pub struct StructFieldId {
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub struct ImplId(salsa::InternId);
-type ImplLoc = ItemLoc<ast::ImplBlock>;
+type ImplLoc = ItemLoc<ast::ImplDef>;
 impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl);
 
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
index 0e8c9da763cfa7838a3493c2f13e1b621910d056..ea3c00da817b96faa343c712f396463949a5a2c5 100644 (file)
@@ -213,7 +213,7 @@ pub(super) struct MacroData {
 
 #[derive(Debug, PartialEq, Eq)]
 pub(super) struct ImplData {
-    pub(super) ast_id: FileAstId<ast::ImplBlock>,
+    pub(super) ast_id: FileAstId<ast::ImplDef>,
 }
 
 struct RawItemsCollector {
@@ -249,7 +249,7 @@ fn add_item(&mut self, current_module: Option<Module>, item: ast::ModuleItem) {
                 self.add_extern_crate_item(current_module, extern_crate);
                 return;
             }
-            ast::ModuleItem::ImplBlock(it) => {
+            ast::ModuleItem::ImplDef(it) => {
                 self.add_impl(current_module, it);
                 return;
             }
@@ -395,7 +395,7 @@ fn add_macro(&mut self, current_module: Option<Module>, m: ast::MacroCall) {
         self.push_item(current_module, attrs, RawItemKind::Macro(m));
     }
 
-    fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplBlock) {
+    fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplDef) {
         let attrs = self.parse_attrs(&imp);
         let ast_id = self.source_ast_id_map.ast_id(&imp);
         let imp = self.raw_items.impls.alloc(ImplData { ast_id });
index 9dd4fa555c1d4d7b81f22b35ad1e916812774a40..2734d51a0afa31c4298dbee08a21c94c49da3f5b 100644 (file)
@@ -52,7 +52,7 @@ enum Scope {
     /// Brings the generic parameters of an item into scope
     GenericParams { def: GenericDefId, params: Arc<GenericParams> },
     /// Brings `Self` in `impl` block into scope
-    ImplBlockScope(ImplId),
+    ImplDefScope(ImplId),
     /// Brings `Self` in enum, struct and union definitions into scope
     AdtScope(AdtId),
     /// Local bindings
@@ -154,7 +154,7 @@ pub fn resolve_path_in_type_ns(
             match scope {
                 Scope::ExprScope(_) => continue,
                 Scope::GenericParams { .. }
-                | Scope::ImplBlockScope(_)
+                | Scope::ImplDefScope(_)
                 | Scope::LocalItemsScope(_)
                     if skip_to_mod =>
                 {
@@ -170,7 +170,7 @@ pub fn resolve_path_in_type_ns(
                         ));
                     }
                 }
-                Scope::ImplBlockScope(impl_) => {
+                Scope::ImplDefScope(impl_) => {
                     if first_name == &name![Self] {
                         let idx = if path.segments.len() == 1 { None } else { Some(1) };
                         return Some((TypeNs::SelfType(*impl_), idx));
@@ -263,7 +263,7 @@ pub fn resolve_path_in_value_ns(
                 Scope::AdtScope(_)
                 | Scope::ExprScope(_)
                 | Scope::GenericParams { .. }
-                | Scope::ImplBlockScope(_)
+                | Scope::ImplDefScope(_)
                 | Scope::LocalItemsScope(_)
                     if skip_to_mod =>
                 {
@@ -291,7 +291,7 @@ pub fn resolve_path_in_value_ns(
                 }
                 Scope::GenericParams { .. } => continue,
 
-                Scope::ImplBlockScope(impl_) if n_segments > 1 => {
+                Scope::ImplDefScope(impl_) if n_segments > 1 => {
                     if first_name == &name![Self] {
                         let ty = TypeNs::SelfType(*impl_);
                         return Some(ResolveValueResult::Partial(ty, 1));
@@ -303,7 +303,7 @@ pub fn resolve_path_in_value_ns(
                         return Some(ResolveValueResult::Partial(ty, 1));
                     }
                 }
-                Scope::ImplBlockScope(_) | Scope::AdtScope(_) => continue,
+                Scope::ImplDefScope(_) | Scope::AdtScope(_) => continue,
 
                 Scope::ModuleScope(m) => {
                     let (module_def, idx) = m.crate_def_map.resolve_path(
@@ -503,7 +503,7 @@ fn process_names(&self, db: &impl DefDatabase, f: &mut dyn FnMut(Name, ScopeDef)
                     }
                 }
             }
-            Scope::ImplBlockScope(i) => {
+            Scope::ImplDefScope(i) => {
                 f(name![Self], ScopeDef::ImplSelfType(*i));
             }
             Scope::AdtScope(i) => {
@@ -550,8 +550,8 @@ fn push_generic_params_scope(self, db: &impl DefDatabase, def: GenericDefId) ->
         self.push_scope(Scope::GenericParams { def, params })
     }
 
-    fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver {
-        self.push_scope(Scope::ImplBlockScope(impl_block))
+    fn push_impl_def_scope(self, impl_def: ImplId) -> Resolver {
+        self.push_scope(Scope::ImplDefScope(impl_def))
     }
 
     fn push_module_scope(
@@ -634,7 +634,7 @@ fn resolver(self, db: &impl DefDatabase) -> Resolver {
             .container
             .resolver(db)
             .push_generic_params_scope(db, self.into())
-            .push_impl_block_scope(self)
+            .push_impl_def_scope(self)
     }
 }
 
index e9bfcfa176808b661bbfb310c6abba6253656d14..85d85182f37eaa3c66ca968062fe9d2bcddf3b1c 100644 (file)
@@ -11,7 +11,7 @@
 use ra_prof::profile;
 
 use crate::{
-    method_resolution::CrateImplBlocks,
+    method_resolution::CrateImplDefs,
     traits::{chalk, AssocTyValue, Impl},
     Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty,
     TyDefId, TypeCtor, ValueTyDefId,
@@ -59,8 +59,8 @@ fn generic_predicates_for_param(
     #[salsa::invoke(crate::lower::generic_defaults_query)]
     fn generic_defaults(&self, def: GenericDefId) -> Substs;
 
-    #[salsa::invoke(crate::method_resolution::CrateImplBlocks::impls_in_crate_query)]
-    fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplBlocks>;
+    #[salsa::invoke(crate::method_resolution::CrateImplDefs::impls_in_crate_query)]
+    fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>;
 
     #[salsa::invoke(crate::traits::impls_for_trait_query)]
     fn impls_for_trait(&self, krate: CrateId, trait_: TraitId) -> Arc<[ImplId]>;
index 988d83af52940844603c8a83e02773d2758d8e1d..df5901835ad9ad021b8031dcb910007eef7db23c 100644 (file)
@@ -42,19 +42,19 @@ fn for_impl(ty: &Ty) -> Option<TyFingerprint> {
 }
 
 #[derive(Debug, PartialEq, Eq)]
-pub struct CrateImplBlocks {
+pub struct CrateImplDefs {
     impls: FxHashMap<TyFingerprint, Vec<ImplId>>,
     impls_by_trait: FxHashMap<TraitId, Vec<ImplId>>,
 }
 
-impl CrateImplBlocks {
+impl CrateImplDefs {
     pub(crate) fn impls_in_crate_query(
         db: &impl HirDatabase,
         krate: CrateId,
-    ) -> Arc<CrateImplBlocks> {
+    ) -> Arc<CrateImplDefs> {
         let _p = profile("impls_in_crate_query");
         let mut res =
-            CrateImplBlocks { impls: FxHashMap::default(), impls_by_trait: FxHashMap::default() };
+            CrateImplDefs { impls: FxHashMap::default(), impls_by_trait: FxHashMap::default() };
 
         let crate_def_map = db.crate_def_map(krate);
         for (_module_id, module_data) in crate_def_map.modules.iter() {
@@ -75,12 +75,12 @@ pub(crate) fn impls_in_crate_query(
 
         Arc::new(res)
     }
-    pub fn lookup_impl_blocks(&self, ty: &Ty) -> impl Iterator<Item = ImplId> + '_ {
+    pub fn lookup_impl_defs(&self, ty: &Ty) -> impl Iterator<Item = ImplId> + '_ {
         let fingerprint = TyFingerprint::for_impl(ty);
         fingerprint.and_then(|f| self.impls.get(&f)).into_iter().flatten().copied()
     }
 
-    pub fn lookup_impl_blocks_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ {
+    pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ {
         self.impls_by_trait.get(&tr).into_iter().flatten().copied()
     }
 
@@ -131,7 +131,7 @@ macro_rules! lang_item_crate {
         let res = lang_item_targets
             .into_iter()
             .filter_map(|it| match it {
-                LangItemTarget::ImplBlockId(it) => Some(it),
+                LangItemTarget::ImplDefId(it) => Some(it),
                 _ => None,
             })
             .map(|it| it.lookup(db).container.module(db).krate)
@@ -177,7 +177,7 @@ pub enum LookupMode {
 }
 
 // This would be nicer if it just returned an iterator, but that runs into
-// lifetime problems, because we need to borrow temp `CrateImplBlocks`.
+// lifetime problems, because we need to borrow temp `CrateImplDefs`.
 // FIXME add a context type here?
 pub fn iterate_method_candidates<T>(
     ty: &Canonical<Ty>,
@@ -425,8 +425,8 @@ fn iterate_inherent_methods<T>(
     for krate in self_ty.value.def_crates(db, krate)? {
         let impls = db.impls_in_crate(krate);
 
-        for impl_block in impls.lookup_impl_blocks(&self_ty.value) {
-            for &item in db.impl_data(impl_block).items.iter() {
+        for impl_def in impls.lookup_impl_defs(&self_ty.value) {
+            for &item in db.impl_data(impl_def).items.iter() {
                 if !is_valid_candidate(db, name, receiver_ty, item, self_ty) {
                     continue;
                 }
@@ -434,8 +434,7 @@ fn iterate_inherent_methods<T>(
                 // that the impl is for. If we have a receiver type, this
                 // already happens in `is_valid_candidate` above; if not, we
                 // check it here
-                if receiver_ty.is_none() && inherent_impl_substs(db, impl_block, self_ty).is_none()
-                {
+                if receiver_ty.is_none() && inherent_impl_substs(db, impl_def, self_ty).is_none() {
                     test_utils::tested_by!(impl_self_type_match_without_receiver);
                     continue;
                 }
index 652420ea8b2a94dddcf3085b47677863e61ca910..53cd81d464571766cfb7022edec6a46e834a8b95 100644 (file)
@@ -4,7 +4,7 @@
 use ra_db::fixture::WithFixture;
 
 #[test]
-fn cfg_impl_block() {
+fn cfg_impl_def() {
     let (db, pos) = TestDB::with_position(
         r#"
 //- /main.rs crate:main deps:foo cfg:test
@@ -347,17 +347,17 @@ macro_rules! _foo {
 m::foo!(foo);
 use foo as bar;
 fn f() -> bar { 0 }
-fn main() {  
+fn main() {
     let _a  = f();
 }
 "#),
         @r###"
         [159; 164) '{ 0 }': u64
         [161; 162) '0': u64
-        [175; 199) '{     ...f(); }': ()
-        [187; 189) '_a': u64
-        [193; 194) 'f': fn f() -> u64
-        [193; 196) 'f()': u64        
+        [175; 197) '{     ...f(); }': ()
+        [185; 187) '_a': u64
+        [191; 192) 'f': fn f() -> u64
+        [191; 194) 'f()': u64
     "###
     );
 }
index 17aef94903a82e8ac34cddbd52ce5068197a2032..bc6ee2600c384ddf08df0f37c313458866a2159d 100644 (file)
@@ -131,8 +131,8 @@ pub(crate) fn impls_for_trait_query(
     for dep in db.crate_graph().dependencies(krate) {
         impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter());
     }
-    let crate_impl_blocks = db.impls_in_crate(krate);
-    impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_));
+    let crate_impl_defs = db.impls_in_crate(krate);
+    impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_));
     impls.into_iter().collect()
 }
 
@@ -346,7 +346,7 @@ pub struct UnsizeToSuperTraitObjectData {
 #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
 pub enum Impl {
     /// A normal impl from an impl block.
-    ImplBlock(ImplId),
+    ImplDef(ImplId),
     /// Closure types implement the Fn traits synthetically.
     ClosureFnTraitImpl(ClosureFnTraitImplData),
     /// [T; n]: Unsize<[T]>
index cc0f3eeb46bcd9d2e202b755c486599befb828c0..03f9b4e2716ed9c8f5b97466a6ee3505f0c15519 100644 (file)
@@ -96,7 +96,7 @@ fn get_builtin_unsize_impls(
 
 pub(super) fn impl_datum(db: &impl HirDatabase, krate: CrateId, impl_: Impl) -> BuiltinImplData {
     match impl_ {
-        Impl::ImplBlock(_) => unreachable!(),
+        Impl::ImplDef(_) => unreachable!(),
         Impl::ClosureFnTraitImpl(data) => closure_fn_trait_impl_datum(db, krate, data),
         Impl::UnsizeArray => array_unsize_impl_datum(db, krate),
         Impl::UnsizeToTraitObject(trait_) => trait_object_unsize_impl_datum(db, krate, trait_),
index 5b6c1a62e09e08d5fe95ebd4fb1ce0adb5b75ab0..4001aa94174ec53e03f0ce5fa315365aaf548375 100644 (file)
@@ -576,7 +576,7 @@ fn impls_for_trait(
             .impls_for_trait(self.krate, trait_)
             .iter()
             .copied()
-            .map(Impl::ImplBlock)
+            .map(Impl::ImplDef)
             .map(|impl_| impl_.to_chalk(self.db))
             .collect();
 
@@ -712,12 +712,12 @@ pub(crate) fn impl_datum_query(
     debug!("impl_datum {:?}", impl_id);
     let impl_: Impl = from_chalk(db, impl_id);
     match impl_ {
-        Impl::ImplBlock(impl_block) => impl_block_datum(db, krate, impl_id, impl_block),
+        Impl::ImplDef(impl_def) => impl_def_datum(db, krate, impl_id, impl_def),
         _ => Arc::new(builtin::impl_datum(db, krate, impl_).to_chalk(db)),
     }
 }
 
-fn impl_block_datum(
+fn impl_def_datum(
     db: &impl HirDatabase,
     krate: CrateId,
     chalk_id: ImplId,
@@ -815,7 +815,7 @@ fn type_alias_associated_ty_value(
     let ty = db.ty(type_alias.into());
     let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) };
     let value = chalk_rust_ir::AssociatedTyValue {
-        impl_id: Impl::ImplBlock(impl_id).to_chalk(db),
+        impl_id: Impl::ImplDef(impl_id).to_chalk(db),
         associated_ty_id: assoc_ty.to_chalk(db),
         value: make_binders(value_bound, ty.num_binders),
     };
index 9a27c164b705616e66c2792d45d1e2b4397baca1..18a1d29956c9c73d6d638478f947f85dad348b7c 100644 (file)
@@ -3,7 +3,7 @@
 //! This module adds the completion items related to implementing associated
 //! items within a `impl Trait for Struct` block. The current context node
 //! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node
-//! and an direct child of an `IMPL_BLOCK`.
+//! and an direct child of an `IMPL_DEF`.
 //!
 //! # Examples
 //!
@@ -55,49 +55,43 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
         _ => false,
     });
 
-    let impl_block = trigger
+    let impl_def = trigger
         .as_ref()
         .and_then(|node| node.parent())
         .and_then(|node| node.parent())
-        .and_then(ast::ImplBlock::cast);
+        .and_then(ast::ImplDef::cast);
 
-    if let (Some(trigger), Some(impl_block)) = (trigger, impl_block) {
+    if let (Some(trigger), Some(impl_def)) = (trigger, impl_def) {
         match trigger.kind() {
             SyntaxKind::FN_DEF => {
-                for missing_fn in
-                    get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| {
-                        match item {
-                            hir::AssocItem::Function(fn_item) => Some(fn_item),
-                            _ => None,
-                        }
-                    })
-                {
+                for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
+                    |item| match item {
+                        hir::AssocItem::Function(fn_item) => Some(fn_item),
+                        _ => None,
+                    },
+                ) {
                     add_function_impl(&trigger, acc, ctx, &missing_fn);
                 }
             }
 
             SyntaxKind::TYPE_ALIAS_DEF => {
-                for missing_fn in
-                    get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| {
-                        match item {
-                            hir::AssocItem::TypeAlias(type_item) => Some(type_item),
-                            _ => None,
-                        }
-                    })
-                {
+                for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
+                    |item| match item {
+                        hir::AssocItem::TypeAlias(type_item) => Some(type_item),
+                        _ => None,
+                    },
+                ) {
                     add_type_alias_impl(&trigger, acc, ctx, &missing_fn);
                 }
             }
 
             SyntaxKind::CONST_DEF => {
-                for missing_fn in
-                    get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| {
-                        match item {
-                            hir::AssocItem::Const(const_item) => Some(const_item),
-                            _ => None,
-                        }
-                    })
-                {
+                for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
+                    |item| match item {
+                        hir::AssocItem::Const(const_item) => Some(const_item),
+                        _ => None,
+                    },
+                ) {
                     add_const_impl(&trigger, acc, ctx, &missing_fn);
                 }
             }
index 81321a897f7c929ff111d91742f63c12843896fd..9aa5a705d5a62deb369f4f199695735be2878b3b 100644 (file)
@@ -27,7 +27,7 @@ pub(crate) struct CompletionContext<'a> {
     pub(super) use_item_syntax: Option<ast::UseItem>,
     pub(super) record_lit_syntax: Option<ast::RecordLit>,
     pub(super) record_lit_pat: Option<ast::RecordPat>,
-    pub(super) impl_block: Option<ast::ImplBlock>,
+    pub(super) impl_def: Option<ast::ImplDef>,
     pub(super) is_param: bool,
     /// If a name-binding or reference to a const in a pattern.
     /// Irrefutable patterns (like let) are excluded.
@@ -81,7 +81,7 @@ pub(super) fn new(
             use_item_syntax: None,
             record_lit_syntax: None,
             record_lit_pat: None,
-            impl_block: None,
+            impl_def: None,
             is_param: false,
             is_pat_binding: false,
             is_trivial_path: false,
@@ -161,12 +161,12 @@ fn classify_name_ref(&mut self, original_file: &SourceFile, name_ref: ast::NameR
             self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset);
         }
 
-        self.impl_block = self
+        self.impl_def = self
             .token
             .parent()
             .ancestors()
             .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
-            .find_map(ast::ImplBlock::cast);
+            .find_map(ast::ImplDef::cast);
 
         let top_node = name_ref
             .syntax()
index 5afb23764e917b556cf9f3637c588b869167488d..4d3dd477ef4d7b139cd5f41cef3eb66e8b271df4 100644 (file)
@@ -269,7 +269,7 @@ fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
     }
 }
 
-impl ToNav for hir::ImplBlock {
+impl ToNav for hir::ImplDef {
     fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
         let src = self.source(db);
         let frange = if let Some(item) = self.is_builtin_derive(db) {
index 944cc79df13a2aaa5b5cc439785289f361c9e7ca..5774e9a8b410bd886b1eff94c13922b45d635684 100644 (file)
@@ -129,7 +129,7 @@ fn collapse_ws(node: &SyntaxNode, output: &mut String) {
             ast::RecordFieldDef(it) => { decl_with_ascription(it) },
             ast::ConstDef(it) => { decl_with_ascription(it) },
             ast::StaticDef(it) => { decl_with_ascription(it) },
-            ast::ImplBlock(it) => {
+            ast::ImplDef(it) => {
                 let target_type = it.target_type()?;
                 let target_trait = it.target_trait();
                 let label = match target_trait {
@@ -360,7 +360,7 @@ fn very_obsolete() {}
                 label: "impl E",
                 navigation_range: [239; 240),
                 node_range: [234; 243),
-                kind: IMPL_BLOCK,
+                kind: IMPL_DEF,
                 detail: None,
                 deprecated: false,
             },
@@ -369,7 +369,7 @@ fn very_obsolete() {}
                 label: "impl fmt::Debug for E",
                 navigation_range: [265; 266),
                 node_range: [245; 269),
-                kind: IMPL_BLOCK,
+                kind: IMPL_DEF,
                 detail: None,
                 deprecated: false,
             },
index 5a079de2709d8b130e3f9b3ef6c11e503cc5962d..f6667cb3315563c4f6b2b5a60815f5f139e56153 100644 (file)
@@ -195,7 +195,7 @@ fn main() {
             mat<|>ch_ast! {
                 match container {
                     ast::TraitDef(it) => {},
-                    ast::ImplBlock(it) => {},
+                    ast::ImplDef(it) => {},
                     _ => { continue },
                 }
             }
@@ -207,7 +207,7 @@ fn main() {
         assert_snapshot!(res.expansion, @r###"
 {
   if let Some(it) = ast::TraitDef::cast(container.clone()){}
-  else if let Some(it) = ast::ImplBlock::cast(container.clone()){}
+  else if let Some(it) = ast::ImplDef::cast(container.clone()){}
   else {
     {
       continue
index 621ab982c350f3f3104ea3dc827c9338330b08d5..e675852035994a4d2ac4f3a32cbbcf952327e039 100644 (file)
@@ -477,7 +477,7 @@ pub fn new() -> Self {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [12; 73)",
+            "impl IMPL_DEF FileId(1) [12; 73)",
             "impl Foo {...}",
         );
 
@@ -491,7 +491,7 @@ pub fn new() -> Self<|> {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [12; 73)",
+            "impl IMPL_DEF FileId(1) [12; 73)",
             "impl Foo {...}",
         );
 
@@ -505,7 +505,7 @@ pub fn new() -> Self<|> {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [15; 75)",
+            "impl IMPL_DEF FileId(1) [15; 75)",
             "impl Foo {...}",
         );
 
@@ -518,7 +518,7 @@ pub fn thing(a: &Self<|>) {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [15; 62)",
+            "impl IMPL_DEF FileId(1) [15; 62)",
             "impl Foo {...}",
         );
     }
@@ -538,7 +538,7 @@ fn new() -> Self {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [49; 115)",
+            "impl IMPL_DEF FileId(1) [49; 115)",
             "impl Make for Foo {...}",
         );
 
@@ -555,7 +555,7 @@ fn new() -> Self<|> {
                 }
             }
             ",
-            "impl IMPL_BLOCK FileId(1) [49; 115)",
+            "impl IMPL_DEF FileId(1) [49; 115)",
             "impl Make for Foo {...}",
         );
     }
index bf82b2a168598c17c0b3bd90ea116a0ca7e473a3..68529c8a58297c5c26e30808d95ebeeffa03e48d 100644 (file)
@@ -1,6 +1,6 @@
 //! FIXME: write short doc here
 
-use hir::{Crate, ImplBlock, Semantics};
+use hir::{Crate, ImplDef, Semantics};
 use ra_ide_db::RootDatabase;
 use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
 
@@ -42,12 +42,12 @@ fn impls_for_def(
         ast::NominalDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db),
     };
 
-    let impls = ImplBlock::all_in_crate(sema.db, krate);
+    let impls = ImplDef::all_in_crate(sema.db, krate);
 
     Some(
         impls
             .into_iter()
-            .filter(|impl_block| ty.is_equal_for_find_impls(&impl_block.target_ty(sema.db)))
+            .filter(|impl_def| ty.is_equal_for_find_impls(&impl_def.target_ty(sema.db)))
             .map(|imp| imp.to_nav(sema.db))
             .collect(),
     )
@@ -60,7 +60,7 @@ fn impls_for_trait(
 ) -> Option<Vec<NavigationTarget>> {
     let tr = sema.to_def(node)?;
 
-    let impls = ImplBlock::for_trait(sema.db, krate, tr);
+    let impls = ImplDef::for_trait(sema.db, krate, tr);
 
     Some(impls.into_iter().map(|imp| imp.to_nav(sema.db)).collect())
 }
@@ -86,7 +86,7 @@ fn goto_implementation_works() {
             struct Foo<|>;
             impl Foo {}
             ",
-            &["impl IMPL_BLOCK FileId(1) [12; 23)"],
+            &["impl IMPL_DEF FileId(1) [12; 23)"],
         );
     }
 
@@ -99,7 +99,7 @@ fn goto_implementation_works_multiple_blocks() {
             impl Foo {}
             impl Foo {}
             ",
-            &["impl IMPL_BLOCK FileId(1) [12; 23)", "impl IMPL_BLOCK FileId(1) [24; 35)"],
+            &["impl IMPL_DEF FileId(1) [12; 23)", "impl IMPL_DEF FileId(1) [24; 35)"],
         );
     }
 
@@ -116,7 +116,7 @@ mod b {
                 impl super::Foo {}
             }
             ",
-            &["impl IMPL_BLOCK FileId(1) [24; 42)", "impl IMPL_BLOCK FileId(1) [57; 75)"],
+            &["impl IMPL_DEF FileId(1) [24; 42)", "impl IMPL_DEF FileId(1) [57; 75)"],
         );
     }
 
@@ -133,7 +133,7 @@ impl crate::Foo {}
             //- /b.rs
             impl crate::Foo {}
             ",
-            &["impl IMPL_BLOCK FileId(2) [0; 18)", "impl IMPL_BLOCK FileId(3) [0; 18)"],
+            &["impl IMPL_DEF FileId(2) [0; 18)", "impl IMPL_DEF FileId(3) [0; 18)"],
         );
     }
 
@@ -146,7 +146,7 @@ trait T<|> {}
             struct Foo;
             impl T for Foo {}
             ",
-            &["impl IMPL_BLOCK FileId(1) [23; 40)"],
+            &["impl IMPL_DEF FileId(1) [23; 40)"],
         );
     }
 
@@ -164,7 +164,7 @@ impl crate::T for crate::Foo {}
             //- /b.rs
             impl crate::T for crate::Foo {}
             ",
-            &["impl IMPL_BLOCK FileId(2) [0; 31)", "impl IMPL_BLOCK FileId(3) [0; 31)"],
+            &["impl IMPL_DEF FileId(2) [0; 31)", "impl IMPL_DEF FileId(3) [0; 31)"],
         );
     }
 
@@ -180,9 +180,9 @@ impl T for Foo {}
             impl T for &Foo {}
             ",
             &[
-                "impl IMPL_BLOCK FileId(1) [23; 34)",
-                "impl IMPL_BLOCK FileId(1) [35; 52)",
-                "impl IMPL_BLOCK FileId(1) [53; 71)",
+                "impl IMPL_DEF FileId(1) [23; 34)",
+                "impl IMPL_DEF FileId(1) [35; 52)",
+                "impl IMPL_DEF FileId(1) [53; 71)",
             ],
         );
     }
@@ -195,7 +195,7 @@ fn goto_implementation_to_builtin_derive() {
             #[derive(Copy)]
             struct Foo<|>;
             ",
-            &["impl IMPL_BLOCK FileId(1) [0; 15)"],
+            &["impl IMPL_DEF FileId(1) [0; 15)"],
         );
     }
 }
index 91b21429a65b0211623a698d8a0def7d42ddaa9b..fdd07d8d186f26b0392b162941e9f77f97fd7884 100644 (file)
@@ -61,7 +61,7 @@ pub(crate) fn classify_name_ref(
         PathResolution::Local(local) => NameDefinition::Local(local),
         PathResolution::TypeParam(par) => NameDefinition::TypeParam(par),
         PathResolution::Macro(def) => NameDefinition::Macro(def),
-        PathResolution::SelfType(impl_block) => NameDefinition::SelfType(impl_block),
+        PathResolution::SelfType(impl_def) => NameDefinition::SelfType(impl_def),
     };
     Some(res)
 }
index 93f32ba855d8df0ae930f475985d44744a169f2e..ad46389069886a1af24f94af11cdcff04a09d662 100644 (file)
@@ -6,7 +6,7 @@
 // FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
 
 use hir::{
-    Adt, FieldSource, HasSource, ImplBlock, Local, MacroDef, Module, ModuleDef, Semantics,
+    Adt, FieldSource, HasSource, ImplDef, Local, MacroDef, Module, ModuleDef, Semantics,
     StructField, TypeParam,
 };
 use ra_prof::profile;
@@ -22,7 +22,7 @@ pub enum NameDefinition {
     Macro(MacroDef),
     StructField(StructField),
     ModuleDef(ModuleDef),
-    SelfType(ImplBlock),
+    SelfType(ImplDef),
     Local(Local),
     TypeParam(TypeParam),
 }
index a46e11e1d945df91fa64a32947783041fd26b230..58098e8106aace380732c353f0b0ce00b55dc704 100644 (file)
@@ -152,7 +152,7 @@ pub(crate) fn reparser(
         EXTERN_ITEM_LIST => items::extern_item_list,
         TOKEN_TREE if first_child? == T!['{'] => items::token_tree,
         ITEM_LIST => match parent? {
-            IMPL_BLOCK => items::impl_item_list,
+            IMPL_DEF => items::impl_item_list,
             TRAIT_DEF => items::trait_item_list,
             MODULE => items::mod_item_list,
             _ => return None,
index f8b43866cb5be72d6eb8183c2848dd5b82d77cd2..433ed6812fb70289fddde6c11218e95e2fce4ff1 100644 (file)
@@ -202,8 +202,8 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
         // test unsafe_default_impl
         // unsafe default impl Foo {}
         T![impl] => {
-            traits::impl_block(p);
-            m.complete(p, IMPL_BLOCK);
+            traits::impl_def(p);
+            m.complete(p, IMPL_DEF);
         }
 
         // test existential_type
index 03dae3cdb4e1af498b7f2af094a66392fa2f440e..c819e33be971700e83c80147a5a7ae3ad698d7ed 100644 (file)
@@ -53,9 +53,9 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
     m.complete(p, ITEM_LIST);
 }
 
-// test impl_block
+// test impl_def
 // impl Foo {}
-pub(super) fn impl_block(p: &mut Parser) {
+pub(super) fn impl_def(p: &mut Parser) {
     assert!(p.at(T![impl]));
     p.bump(T![impl]);
     if choose_type_params_over_qpath(p) {
@@ -65,7 +65,7 @@ pub(super) fn impl_block(p: &mut Parser) {
     // FIXME: never type
     // impl ! {}
 
-    // test impl_block_neg
+    // test impl_def_neg
     // impl !Send for X {}
     p.eat(T![!]);
     impl_type(p);
index 1068da0a06316a5c1bc3882dec91849cb903a581..dfc30d727831aed7aef8da8d057f807854f3f0bf 100644 (file)
@@ -133,7 +133,7 @@ pub enum SyntaxKind {
     STATIC_DEF,
     CONST_DEF,
     TRAIT_DEF,
-    IMPL_BLOCK,
+    IMPL_DEF,
     TYPE_ALIAS_DEF,
     MACRO_CALL,
     TOKEN_TREE,
index 44de4af892b1b7ab00327ad449d1a2b655dbd493..d5986e8b4a9f13c166a1229047c5cd84be1d1cb6 100644 (file)
@@ -169,7 +169,7 @@ pub fn parent_use_tree(&self) -> ast::UseTree {
     }
 }
 
-impl ast::ImplBlock {
+impl ast::ImplDef {
     pub fn target_type(&self) -> Option<ast::TypeRef> {
         match self.target() {
             (Some(t), None) | (_, Some(t)) => Some(t),
index 8eb240801d507d8ed6ec3befe4a07cbf4e7de10d..150893e393e1c99e20a349dc80300ad6cd301d90 100644 (file)
@@ -552,13 +552,13 @@ pub fn type_ref(&self) -> Option<TypeRef> {
     }
 }
 #[derive(Debug, Clone, PartialEq, Eq, Hash)]
-pub struct ImplBlock {
+pub struct ImplDef {
     pub(crate) syntax: SyntaxNode,
 }
-impl AstNode for ImplBlock {
+impl AstNode for ImplDef {
     fn can_cast(kind: SyntaxKind) -> bool {
         match kind {
-            IMPL_BLOCK => true,
+            IMPL_DEF => true,
             _ => false,
         }
     }
@@ -573,9 +573,9 @@ fn syntax(&self) -> &SyntaxNode {
         &self.syntax
     }
 }
-impl ast::TypeParamsOwner for ImplBlock {}
-impl ast::AttrsOwner for ImplBlock {}
-impl ImplBlock {
+impl ast::TypeParamsOwner for ImplDef {}
+impl ast::AttrsOwner for ImplDef {}
+impl ImplDef {
     pub fn item_list(&self) -> Option<ItemList> {
         AstChildren::new(&self.syntax).next()
     }
@@ -3524,7 +3524,7 @@ pub enum ModuleItem {
     FnDef(FnDef),
     TraitDef(TraitDef),
     TypeAliasDef(TypeAliasDef),
-    ImplBlock(ImplBlock),
+    ImplDef(ImplDef),
     UseItem(UseItem),
     ExternCrateItem(ExternCrateItem),
     ConstDef(ConstDef),
@@ -3561,9 +3561,9 @@ fn from(node: TypeAliasDef) -> ModuleItem {
         ModuleItem::TypeAliasDef(node)
     }
 }
-impl From<ImplBlock> for ModuleItem {
-    fn from(node: ImplBlock) -> ModuleItem {
-        ModuleItem::ImplBlock(node)
+impl From<ImplDef> for ModuleItem {
+    fn from(node: ImplDef) -> ModuleItem {
+        ModuleItem::ImplDef(node)
     }
 }
 impl From<UseItem> for ModuleItem {
@@ -3594,8 +3594,8 @@ fn from(node: Module) -> ModuleItem {
 impl AstNode for ModuleItem {
     fn can_cast(kind: SyntaxKind) -> bool {
         match kind {
-            STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF
-            | IMPL_BLOCK | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true,
+            STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF
+            | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true,
             _ => false,
         }
     }
@@ -3607,7 +3607,7 @@ fn cast(syntax: SyntaxNode) -> Option<Self> {
             FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
             TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
             TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
-            IMPL_BLOCK => ModuleItem::ImplBlock(ImplBlock { syntax }),
+            IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }),
             USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
             EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
             CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
@@ -3625,7 +3625,7 @@ fn syntax(&self) -> &SyntaxNode {
             ModuleItem::FnDef(it) => &it.syntax,
             ModuleItem::TraitDef(it) => &it.syntax,
             ModuleItem::TypeAliasDef(it) => &it.syntax,
-            ModuleItem::ImplBlock(it) => &it.syntax,
+            ModuleItem::ImplDef(it) => &it.syntax,
             ModuleItem::UseItem(it) => &it.syntax,
             ModuleItem::ExternCrateItem(it) => &it.syntax,
             ModuleItem::ConstDef(it) => &it.syntax,
index 863859dcaa2437544d9ec3169c5842d78e2ac13a..7915cf8cb219c43aeff1875656875587d12c0aeb 100644 (file)
@@ -203,12 +203,11 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
         _ => return,
     }
 
-    let impl_block = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplBlock::cast)
-    {
+    let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplDef::cast) {
         Some(it) => it,
         None => return,
     };
-    if impl_block.target_trait().is_some() {
+    if impl_def.target_trait().is_some() {
         errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range()));
     }
 }
index b9e60f6c13176d9554c179f40868f636f4481ccc..4b13a7236344fb09e679c65a708144ddf285f4a9 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 183)
-  IMPL_BLOCK@[0; 182)
+  IMPL_DEF@[0; 182)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 13)
index bb87022b088d5a443fff8690f7b5a780b0a97a6b..9f50c85e52463d7a4bf2fbcac6bc1171b37985d6 100644 (file)
@@ -77,7 +77,7 @@ SOURCE_FILE@[0; 112)
           ERROR@[54; 55)
             COMMA@[54; 55) ","
         WHITESPACE@[55; 56) " "
-        IMPL_BLOCK@[56; 60)
+        IMPL_DEF@[56; 60)
           IMPL_KW@[56; 60) "impl"
         EXPR_STMT@[60; 61)
           ERROR@[60; 61)
index 3942e09049de9a66ab750bd7844c973a44cacf15..f239b7b1e5c348b7f79de9fdeb760b8f3678a299 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 38)
-  IMPL_BLOCK@[0; 14)
+  IMPL_DEF@[0; 14)
     IMPL_KW@[0; 4) "impl"
     TYPE_PARAM_LIST@[4; 14)
       L_ANGLE@[4; 5) "<"
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 38)
                     IDENT@[8; 13) "Clone"
       R_ANGLE@[13; 14) ">"
   WHITESPACE@[14; 15) "\n"
-  IMPL_BLOCK@[15; 37)
+  IMPL_DEF@[15; 37)
     IMPL_KW@[15; 19) "impl"
     TYPE_PARAM_LIST@[19; 22)
       L_ANGLE@[19; 20) "<"
index d0a128a5fb261d85e96ec1111ab82a6bd8ad93f6..d8622d45f2b021e6aa3c0ba5ce64817c3113532e 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 118)
-  IMPL_BLOCK@[0; 117)
+  IMPL_DEF@[0; 117)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 0187d872da632cd53503468b24d51b24b384da3f..01a853d632ab3bc359775ff01acf42b99e422ebc 100644 (file)
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 30)
               LIFETIME@[16; 21) "\'loop"
               COLON@[21; 22) ":"
         WHITESPACE@[22; 23) " "
-        IMPL_BLOCK@[23; 27)
+        IMPL_DEF@[23; 27)
           IMPL_KW@[23; 27) "impl"
         WHITESPACE@[27; 28) "\n"
         R_CURLY@[28; 29) "}"
index d5aea05c2a3e58cb6699eeaaae4d5b57abd9c245..124f0a8919e3cf720a127e7a9348fe0add3f81cc 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 87)
-  IMPL_BLOCK@[0; 12)
+  IMPL_DEF@[0; 12)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 9)
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 87)
       L_CURLY@[10; 11) "{"
       R_CURLY@[11; 12) "}"
   WHITESPACE@[12; 13) "\n"
-  IMPL_BLOCK@[13; 33)
+  IMPL_DEF@[13; 33)
     IMPL_KW@[13; 17) "impl"
     WHITESPACE@[17; 18) " "
     PATH_TYPE@[18; 24)
@@ -33,10 +33,10 @@ SOURCE_FILE@[0; 87)
       L_CURLY@[31; 32) "{"
       R_CURLY@[32; 33) "}"
   WHITESPACE@[33; 34) "\n"
-  IMPL_BLOCK@[34; 38)
+  IMPL_DEF@[34; 38)
     IMPL_KW@[34; 38) "impl"
   WHITESPACE@[38; 39) " "
-  IMPL_BLOCK@[39; 54)
+  IMPL_DEF@[39; 54)
     IMPL_KW@[39; 43) "impl"
     WHITESPACE@[43; 44) " "
     PATH_TYPE@[44; 51)
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 87)
       L_CURLY@[52; 53) "{"
       R_CURLY@[53; 54) "}"
   WHITESPACE@[54; 55) "\n"
-  IMPL_BLOCK@[55; 70)
+  IMPL_DEF@[55; 70)
     IMPL_KW@[55; 59) "impl"
     WHITESPACE@[59; 60) " "
     PATH_TYPE@[60; 66)
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 87)
     WHITESPACE@[66; 67) " "
     FOR_KW@[67; 70) "for"
   WHITESPACE@[70; 71) " "
-  IMPL_BLOCK@[71; 86)
+  IMPL_DEF@[71; 86)
     IMPL_KW@[71; 75) "impl"
     WHITESPACE@[75; 76) " "
     PATH_TYPE@[76; 83)
index d4e710dd4c20c7f014163b13a213a4eac6eb3f21..ad9f0965ea1beb7f475507e78be1e8152b5f08f3 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 83)
-  IMPL_BLOCK@[0; 82)
+  IMPL_DEF@[0; 82)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 0ccd12b0a2febd540e936370ef380aca3ee53263..757ac092a00b5e6f93cdae2a696a8d23d998d931 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 128)
-  IMPL_BLOCK@[0; 127)
+  IMPL_DEF@[0; 127)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index d0beeb81ed3c9e78ce6b24ba26cacca1b71f49f5..89caee54337a694199e407e614c4764f40471dbf 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 69)
-  IMPL_BLOCK@[0; 68)
+  IMPL_DEF@[0; 68)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 0768f05184e9556150909edbad473a253c151aa9..b1af679760e77ebd2cce71377b441759b20ad0c0 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 89)
-  IMPL_BLOCK@[0; 88)
+  IMPL_DEF@[0; 88)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 8f3dcaf888e4e13e1917be5fd6da6ec8696d48ab..0a768a8e3ea7fa8122bd5fadf29593d15761c5ce 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 27)
-  IMPL_BLOCK@[0; 26)
+  IMPL_DEF@[0; 26)
     UNSAFE_KW@[0; 6) "unsafe"
     WHITESPACE@[6; 7) " "
     DEFAULT_KW@[7; 14) "default"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.rs b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.rs
deleted file mode 100644 (file)
index b7527c8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-impl !Send for X {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.txt
deleted file mode 100644 (file)
index dfff947..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-SOURCE_FILE@[0; 20)
-  IMPL_BLOCK@[0; 19)
-    IMPL_KW@[0; 4) "impl"
-    WHITESPACE@[4; 5) " "
-    EXCL@[5; 6) "!"
-    PATH_TYPE@[6; 10)
-      PATH@[6; 10)
-        PATH_SEGMENT@[6; 10)
-          NAME_REF@[6; 10)
-            IDENT@[6; 10) "Send"
-    WHITESPACE@[10; 11) " "
-    FOR_KW@[11; 14) "for"
-    WHITESPACE@[14; 15) " "
-    PATH_TYPE@[15; 16)
-      PATH@[15; 16)
-        PATH_SEGMENT@[15; 16)
-          NAME_REF@[15; 16)
-            IDENT@[15; 16) "X"
-    WHITESPACE@[16; 17) " "
-    ITEM_LIST@[17; 19)
-      L_CURLY@[17; 18) "{"
-      R_CURLY@[18; 19) "}"
-  WHITESPACE@[19; 20) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs
new file mode 100644 (file)
index 0000000..b7527c8
--- /dev/null
@@ -0,0 +1 @@
+impl !Send for X {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.txt b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.txt
new file mode 100644 (file)
index 0000000..0cc3ac0
--- /dev/null
@@ -0,0 +1,23 @@
+SOURCE_FILE@[0; 20)
+  IMPL_DEF@[0; 19)
+    IMPL_KW@[0; 4) "impl"
+    WHITESPACE@[4; 5) " "
+    EXCL@[5; 6) "!"
+    PATH_TYPE@[6; 10)
+      PATH@[6; 10)
+        PATH_SEGMENT@[6; 10)
+          NAME_REF@[6; 10)
+            IDENT@[6; 10) "Send"
+    WHITESPACE@[10; 11) " "
+    FOR_KW@[11; 14) "for"
+    WHITESPACE@[14; 15) " "
+    PATH_TYPE@[15; 16)
+      PATH@[15; 16)
+        PATH_SEGMENT@[15; 16)
+          NAME_REF@[15; 16)
+            IDENT@[15; 16) "X"
+    WHITESPACE@[16; 17) " "
+    ITEM_LIST@[17; 19)
+      L_CURLY@[17; 18) "{"
+      R_CURLY@[18; 19) "}"
+  WHITESPACE@[19; 20) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.rs b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.rs
deleted file mode 100644 (file)
index d6337f6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-impl Foo {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.txt b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.txt
deleted file mode 100644 (file)
index bda3435..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-SOURCE_FILE@[0; 12)
-  IMPL_BLOCK@[0; 11)
-    IMPL_KW@[0; 4) "impl"
-    WHITESPACE@[4; 5) " "
-    PATH_TYPE@[5; 8)
-      PATH@[5; 8)
-        PATH_SEGMENT@[5; 8)
-          NAME_REF@[5; 8)
-            IDENT@[5; 8) "Foo"
-    WHITESPACE@[8; 9) " "
-    ITEM_LIST@[9; 11)
-      L_CURLY@[9; 10) "{"
-      R_CURLY@[10; 11) "}"
-  WHITESPACE@[11; 12) "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rs b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rs
new file mode 100644 (file)
index 0000000..d6337f6
--- /dev/null
@@ -0,0 +1 @@
+impl Foo {}
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.txt b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.txt
new file mode 100644 (file)
index 0000000..4c2863b
--- /dev/null
@@ -0,0 +1,14 @@
+SOURCE_FILE@[0; 12)
+  IMPL_DEF@[0; 11)
+    IMPL_KW@[0; 4) "impl"
+    WHITESPACE@[4; 5) " "
+    PATH_TYPE@[5; 8)
+      PATH@[5; 8)
+        PATH_SEGMENT@[5; 8)
+          NAME_REF@[5; 8)
+            IDENT@[5; 8) "Foo"
+    WHITESPACE@[8; 9) " "
+    ITEM_LIST@[9; 11)
+      L_CURLY@[9; 10) "{"
+      R_CURLY@[10; 11) "}"
+  WHITESPACE@[11; 12) "\n"
index 590e2a88f84a72a26f305596473924404f4a64ef..e614acc6faa486b71add74d37f1a35fcde1afb67 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 19)
-  IMPL_BLOCK@[0; 18)
+  IMPL_DEF@[0; 18)
     UNSAFE_KW@[0; 6) "unsafe"
     WHITESPACE@[6; 7) " "
     IMPL_KW@[7; 11) "impl"
index ada94a8249b4ed57ee360de56b0aa0f2151efc98..af9077270154ac09f25bbfaf9f5447a8110397e6 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 20)
-  IMPL_BLOCK@[0; 19)
+  IMPL_DEF@[0; 19)
     DEFAULT_KW@[0; 7) "default"
     WHITESPACE@[7; 8) " "
     IMPL_KW@[8; 12) "impl"
index 0e9e9b95b09c42a38afaf4f7b580d5f5f1c96e86..5053ebde73b901ef212851c1c39cebe503485e45 100644 (file)
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 94)
       L_CURLY@[6; 7) "{"
       R_CURLY@[7; 8) "}"
   WHITESPACE@[8; 9) "\n"
-  IMPL_BLOCK@[9; 93)
+  IMPL_DEF@[9; 93)
     IMPL_KW@[9; 13) "impl"
     WHITESPACE@[13; 14) " "
     PATH_TYPE@[14; 15)
index 022070b0c611c45237f2914300948a9c36da44d3..e1734224b38b9617469fb715cec38b0ba5ee3c91 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 69)
-  IMPL_BLOCK@[0; 68)
+  IMPL_DEF@[0; 68)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 47fadef8544297d81a79e3f4294f88d93c952fa0..2d46eebb3d2ecef7ea4ef921273921c24813c814 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 29)
-  IMPL_BLOCK@[0; 28)
+  IMPL_DEF@[0; 28)
     IMPL_KW@[0; 4) "impl"
     TYPE_PARAM_LIST@[4; 18)
       L_ANGLE@[4; 5) "<"
index 933f5b7bd217fca4feae7d62e04bb71fd29cd2b6..b30030de367dc0e135bfe097ec7aad195c33f608 100644 (file)
@@ -1,5 +1,5 @@
 SOURCE_FILE@[0; 137)
-  IMPL_BLOCK@[0; 136)
+  IMPL_DEF@[0; 136)
     IMPL_KW@[0; 4) "impl"
     WHITESPACE@[4; 5) " "
     PATH_TYPE@[5; 6)
index 72f053dfcec56e4fd568458e5993297a5f050481..341e02704413fa189f792db4377f79b894d953b3 100644 (file)
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 199)
       IDENT@[69; 72) "Foo"
     SEMI@[72; 73) ";"
   WHITESPACE@[73; 75) "\n\n"
-  IMPL_BLOCK@[75; 141)
+  IMPL_DEF@[75; 141)
     IMPL_KW@[75; 79) "impl"
     WHITESPACE@[79; 80) " "
     PATH_TYPE@[80; 83)
index 3d9aab500445d827d386a915ef005a97b96cc05e..e15447ca7223400192c23c02419fed425a062b0c 100644 (file)
@@ -92,7 +92,7 @@ SOURCE_FILE@[0; 686)
   WHITESPACE@[461; 463) "\n\n"
   COMMENT@[463; 523) "// https://github.com ..."
   WHITESPACE@[523; 524) "\n"
-  IMPL_BLOCK@[524; 685)
+  IMPL_DEF@[524; 685)
     IMPL_KW@[524; 528) "impl"
     WHITESPACE@[528; 529) " "
     PATH_TYPE@[529; 537)
index bfd47d2e18850a18b2bc2c46313389e4549784ae..719c99c17fe66bee0e3252838f840333cab5aab5 100644 (file)
@@ -253,7 +253,7 @@ SOURCE_FILE@[0; 519)
       WHITESPACE@[234; 235) "\n"
       R_CURLY@[235; 236) "}"
   WHITESPACE@[236; 238) "\n\n"
-  IMPL_BLOCK@[238; 519)
+  IMPL_DEF@[238; 519)
     IMPL_KW@[238; 242) "impl"
     WHITESPACE@[242; 243) " "
     PATH_TYPE@[243; 244)
index d70d34bdc3828ac3ebe8d9d11b63cab9eea53d44..6bf0be5656196a4e0762db09a348b0bf3b3b2a3b 100644 (file)
@@ -76,8 +76,8 @@ pub fn analysis_stats(
                 }
             }
 
-            for impl_block in module.impl_blocks(db) {
-                for item in impl_block.items(db) {
+            for impl_def in module.impl_defs(db) {
+                for item in impl_def.items(db) {
                     num_decls += 1;
                     if let AssocItem::Function(f) = item {
                         funcs.push(f);
index ff156307a55b4d6aacb6a739b648a1114683b020..eeeb33e8f97bfc1fe4cc54f73501ed68d4a7c44c 100644 (file)
@@ -57,7 +57,7 @@ fn conv(self) -> <Self as Conv>::Output {
             SyntaxKind::RECORD_FIELD_DEF => SymbolKind::Field,
             SyntaxKind::STATIC_DEF => SymbolKind::Constant,
             SyntaxKind::CONST_DEF => SymbolKind::Constant,
-            SyntaxKind::IMPL_BLOCK => SymbolKind::Object,
+            SyntaxKind::IMPL_DEF => SymbolKind::Object,
             _ => SymbolKind::Variable,
         }
     }
index 98d8104e59cbc958113ffc0a00f52a35f7be1fc5..9b58aad975177d4c436df3d3c39f4cac1c37c3d3 100644 (file)
@@ -104,7 +104,7 @@ pub(crate) struct KindsSrc<'a> {
         "STATIC_DEF",
         "CONST_DEF",
         "TRAIT_DEF",
-        "IMPL_BLOCK",
+        "IMPL_DEF",
         "TYPE_ALIAS_DEF",
         "MACRO_CALL",
         "TOKEN_TREE",
@@ -357,7 +357,7 @@ struct TypeAliasDef: VisibilityOwner, NameOwner, TypeParamsOwner, AttrsOwner, Do
             TypeRef,
         }
 
-        struct ImplBlock: TypeParamsOwner, AttrsOwner {
+        struct ImplDef: TypeParamsOwner, AttrsOwner {
             ItemList,
         }
 
@@ -560,7 +560,7 @@ enum ModuleItem: AttrsOwner, VisibilityOwner {
             FnDef,
             TraitDef,
             TypeAliasDef,
-            ImplBlock,
+            ImplDef,
             UseItem,
             ExternCrateItem,
             ConstDef,