aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/ast_transform.rs8
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs6
-rw-r--r--crates/ra_assists/src/handlers/add_new.rs16
-rw-r--r--crates/ra_assists/src/handlers/move_bounds.rs2
-rw-r--r--crates/ra_assists/src/utils.rs10
-rw-r--r--crates/ra_assists/src/utils/insert_use.rs2
-rw-r--r--crates/ra_hir/src/code_model.rs36
-rw-r--r--crates/ra_hir/src/from_id.rs4
-rw-r--r--crates/ra_hir/src/has_source.rs8
-rw-r--r--crates/ra_hir/src/lib.rs2
-rw-r--r--crates/ra_hir/src/semantics.rs2
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs6
-rw-r--r--crates/ra_hir/src/source_analyzer.rs2
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_def/src/data.rs6
-rw-r--r--crates/ra_hir_def/src/keys.rs2
-rw-r--r--crates/ra_hir_def/src/lang_item.rs10
-rw-r--r--crates/ra_hir_def/src/lib.rs2
-rw-r--r--crates/ra_hir_def/src/nameres/raw.rs6
-rw-r--r--crates/ra_hir_def/src/resolver.rs20
-rw-r--r--crates/ra_hir_ty/src/db.rs6
-rw-r--r--crates/ra_hir_ty/src/method_resolution.rs23
-rw-r--r--crates/ra_hir_ty/src/tests/macros.rs12
-rw-r--r--crates/ra_hir_ty/src/traits.rs6
-rw-r--r--crates/ra_hir_ty/src/traits/builtin.rs2
-rw-r--r--crates/ra_hir_ty/src/traits/chalk.rs8
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs50
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs8
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs2
-rw-r--r--crates/ra_ide/src/display/structure.rs6
-rw-r--r--crates/ra_ide/src/expand_macro.rs4
-rw-r--r--crates/ra_ide/src/goto_definition.rs12
-rw-r--r--crates/ra_ide/src/impls.rs28
-rw-r--r--crates/ra_ide/src/references/classify.rs2
-rw-r--r--crates/ra_ide_db/src/defs.rs4
-rw-r--r--crates/ra_parser/src/grammar.rs2
-rw-r--r--crates/ra_parser/src/grammar/items.rs4
-rw-r--r--crates/ra_parser/src/grammar/items/traits.rs6
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/extensions.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated.rs28
-rw-r--r--crates/ra_syntax/src/validation.rs5
-rw-r--r--crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rs (renamed from crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.rs)0
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.txt (renamed from crates/ra_syntax/test_data/parser/inline/ok/0063_impl_block_neg.txt)2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rs (renamed from crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.rs)0
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.txt (renamed from crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.txt)2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt2
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs4
-rw-r--r--crates/rust-analyzer/src/conv.rs2
68 files changed, 215 insertions, 221 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index a74ac42d5..0e53c1eee 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -40,9 +40,9 @@ impl<'a> SubstituteTypeParams<'a> {
40 db: &'a RootDatabase, 40 db: &'a RootDatabase,
41 // FIXME: there's implicit invariant that `trait_` and `source_scope` match... 41 // FIXME: there's implicit invariant that `trait_` and `source_scope` match...
42 trait_: hir::Trait, 42 trait_: hir::Trait,
43 impl_block: ast::ImplBlock, 43 impl_def: ast::ImplDef,
44 ) -> SubstituteTypeParams<'a> { 44 ) -> SubstituteTypeParams<'a> {
45 let substs = get_syntactic_substs(impl_block).unwrap_or_default(); 45 let substs = get_syntactic_substs(impl_def).unwrap_or_default();
46 let generic_def: hir::GenericDef = trait_.into(); 46 let generic_def: hir::GenericDef = trait_.into();
47 let substs_by_param: FxHashMap<_, _> = generic_def 47 let substs_by_param: FxHashMap<_, _> = generic_def
48 .params(db) 48 .params(db)
@@ -59,8 +59,8 @@ impl<'a> SubstituteTypeParams<'a> {
59 59
60 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the 60 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
61 // trait ref, and then go from the types in the substs back to the syntax) 61 // trait ref, and then go from the types in the substs back to the syntax)
62 fn get_syntactic_substs(impl_block: ast::ImplBlock) -> Option<Vec<ast::TypeRef>> { 62 fn get_syntactic_substs(impl_def: ast::ImplDef) -> Option<Vec<ast::TypeRef>> {
63 let target_trait = impl_block.target_trait()?; 63 let target_trait = impl_def.target_trait()?;
64 let path_type = match target_trait { 64 let path_type = match target_trait {
65 ast::TypeRef::PathType(path) => path, 65 ast::TypeRef::PathType(path) => path,
66 _ => return None, 66 _ => return None,
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
index 4005014bd..639180d37 100644
--- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
@@ -101,7 +101,7 @@ fn add_missing_impl_members_inner(
101 label: &'static str, 101 label: &'static str,
102) -> Option<Assist> { 102) -> Option<Assist> {
103 let _p = ra_prof::profile("add_missing_impl_members_inner"); 103 let _p = ra_prof::profile("add_missing_impl_members_inner");
104 let impl_node = ctx.find_node_at_offset::<ast::ImplBlock>()?; 104 let impl_node = ctx.find_node_at_offset::<ast::ImplDef>()?;
105 let impl_item_list = impl_node.item_list()?; 105 let impl_item_list = impl_node.item_list()?;
106 106
107 let trait_ = resolve_target_trait(&ctx.sema, &impl_node)?; 107 let trait_ = resolve_target_trait(&ctx.sema, &impl_node)?;
@@ -257,7 +257,7 @@ impl Foo for S {
257 } 257 }
258 258
259 #[test] 259 #[test]
260 fn test_empty_impl_block() { 260 fn test_empty_impl_def() {
261 check_assist( 261 check_assist(
262 add_missing_impl_members, 262 add_missing_impl_members,
263 " 263 "
@@ -308,7 +308,7 @@ impl<U> Foo<U> for S {
308 } 308 }
309 309
310 #[test] 310 #[test]
311 fn test_cursor_after_empty_impl_block() { 311 fn test_cursor_after_empty_impl_def() {
312 check_assist( 312 check_assist(
313 add_missing_impl_members, 313 add_missing_impl_members,
314 " 314 "
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs
index 166e907fb..697e7cda6 100644
--- a/crates/ra_assists/src/handlers/add_new.rs
+++ b/crates/ra_assists/src/handlers/add_new.rs
@@ -41,14 +41,14 @@ pub(crate) fn add_new(ctx: AssistCtx) -> Option<Assist> {
41 }; 41 };
42 42
43 // Return early if we've found an existing new fn 43 // Return early if we've found an existing new fn
44 let impl_block = find_struct_impl(&ctx, &strukt)?; 44 let impl_def = find_struct_impl(&ctx, &strukt)?;
45 45
46 ctx.add_assist(AssistId("add_new"), "Add default constructor", |edit| { 46 ctx.add_assist(AssistId("add_new"), "Add default constructor", |edit| {
47 edit.target(strukt.syntax().text_range()); 47 edit.target(strukt.syntax().text_range());
48 48
49 let mut buf = String::with_capacity(512); 49 let mut buf = String::with_capacity(512);
50 50
51 if impl_block.is_some() { 51 if impl_def.is_some() {
52 buf.push('\n'); 52 buf.push('\n');
53 } 53 }
54 54
@@ -71,10 +71,10 @@ pub(crate) fn add_new(ctx: AssistCtx) -> Option<Assist> {
71 71
72 buf.push_str("} }"); 72 buf.push_str("} }");
73 73
74 let (start_offset, end_offset) = impl_block 74 let (start_offset, end_offset) = impl_def
75 .and_then(|impl_block| { 75 .and_then(|impl_def| {
76 buf.push('\n'); 76 buf.push('\n');
77 let start = impl_block 77 let start = impl_def
78 .syntax() 78 .syntax()
79 .descendants_with_tokens() 79 .descendants_with_tokens()
80 .find(|t| t.kind() == T!['{'])? 80 .find(|t| t.kind() == T!['{'])?
@@ -128,7 +128,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String {
128// 128//
129// FIXME: change the new fn checking to a more semantic approach when that's more 129// FIXME: change the new fn checking to a more semantic approach when that's more
130// viable (e.g. we process proc macros, etc) 130// viable (e.g. we process proc macros, etc)
131fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<ast::ImplBlock>> { 131fn find_struct_impl(ctx: &AssistCtx, strukt: &ast::StructDef) -> Option<Option<ast::ImplDef>> {
132 let db = ctx.db; 132 let db = ctx.db;
133 let module = strukt.syntax().ancestors().find(|node| { 133 let module = strukt.syntax().ancestors().find(|node| {
134 ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) 134 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
136 136
137 let struct_def = ctx.sema.to_def(strukt)?; 137 let struct_def = ctx.sema.to_def(strukt)?;
138 138
139 let block = module.descendants().filter_map(ast::ImplBlock::cast).find_map(|impl_blk| { 139 let block = module.descendants().filter_map(ast::ImplDef::cast).find_map(|impl_blk| {
140 let blk = ctx.sema.to_def(&impl_blk)?; 140 let blk = ctx.sema.to_def(&impl_blk)?;
141 141
142 // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}` 142 // 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
164 Some(block) 164 Some(block)
165} 165}
166 166
167fn has_new_fn(imp: &ast::ImplBlock) -> bool { 167fn has_new_fn(imp: &ast::ImplDef) -> bool {
168 if let Some(il) = imp.item_list() { 168 if let Some(il) = imp.item_list() {
169 for item in il.impl_items() { 169 for item in il.impl_items() {
170 if let ast::ImplItem::FnDef(f) = item { 170 if let ast::ImplItem::FnDef(f) = item {
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs
index 86b235366..0b501f3e5 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -37,7 +37,7 @@ pub(crate) fn move_bounds_to_where_clause(ctx: AssistCtx) -> Option<Assist> {
37 let anchor: SyntaxElement = match parent.kind() { 37 let anchor: SyntaxElement = match parent.kind() {
38 FN_DEF => ast::FnDef::cast(parent)?.body()?.syntax().clone().into(), 38 FN_DEF => ast::FnDef::cast(parent)?.body()?.syntax().clone().into(),
39 TRAIT_DEF => ast::TraitDef::cast(parent)?.item_list()?.syntax().clone().into(), 39 TRAIT_DEF => ast::TraitDef::cast(parent)?.item_list()?.syntax().clone().into(),
40 IMPL_BLOCK => ast::ImplBlock::cast(parent)?.item_list()?.syntax().clone().into(), 40 IMPL_DEF => ast::ImplDef::cast(parent)?.item_list()?.syntax().clone().into(),
41 ENUM_DEF => ast::EnumDef::cast(parent)?.variant_list()?.syntax().clone().into(), 41 ENUM_DEF => ast::EnumDef::cast(parent)?.variant_list()?.syntax().clone().into(),
42 STRUCT_DEF => parent 42 STRUCT_DEF => parent
43 .children_with_tokens() 43 .children_with_tokens()
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index d544caee7..3d6c59bda 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -13,14 +13,14 @@ pub use insert_use::insert_use_statement;
13 13
14pub fn get_missing_impl_items( 14pub fn get_missing_impl_items(
15 sema: &Semantics<RootDatabase>, 15 sema: &Semantics<RootDatabase>,
16 impl_block: &ast::ImplBlock, 16 impl_def: &ast::ImplDef,
17) -> Vec<hir::AssocItem> { 17) -> Vec<hir::AssocItem> {
18 // Names must be unique between constants and functions. However, type aliases 18 // Names must be unique between constants and functions. However, type aliases
19 // may share the same name as a function or constant. 19 // may share the same name as a function or constant.
20 let mut impl_fns_consts = FxHashSet::default(); 20 let mut impl_fns_consts = FxHashSet::default();
21 let mut impl_type = FxHashSet::default(); 21 let mut impl_type = FxHashSet::default();
22 22
23 if let Some(item_list) = impl_block.item_list() { 23 if let Some(item_list) = impl_def.item_list() {
24 for item in item_list.impl_items() { 24 for item in item_list.impl_items() {
25 match item { 25 match item {
26 ast::ImplItem::FnDef(f) => { 26 ast::ImplItem::FnDef(f) => {
@@ -44,7 +44,7 @@ pub fn get_missing_impl_items(
44 } 44 }
45 } 45 }
46 46
47 resolve_target_trait(sema, impl_block).map_or(vec![], |target_trait| { 47 resolve_target_trait(sema, impl_def).map_or(vec![], |target_trait| {
48 target_trait 48 target_trait
49 .items(sema.db) 49 .items(sema.db)
50 .iter() 50 .iter()
@@ -65,9 +65,9 @@ pub fn get_missing_impl_items(
65 65
66pub(crate) fn resolve_target_trait( 66pub(crate) fn resolve_target_trait(
67 sema: &Semantics<RootDatabase>, 67 sema: &Semantics<RootDatabase>,
68 impl_block: &ast::ImplBlock, 68 impl_def: &ast::ImplDef,
69) -> Option<hir::Trait> { 69) -> Option<hir::Trait> {
70 let ast_path = impl_block 70 let ast_path = impl_def
71 .target_trait() 71 .target_trait()
72 .map(|it| it.syntax().clone()) 72 .map(|it| it.syntax().clone())
73 .and_then(ast::PathType::cast)? 73 .and_then(ast::PathType::cast)?
diff --git a/crates/ra_assists/src/utils/insert_use.rs b/crates/ra_assists/src/utils/insert_use.rs
index 36fd2fc0b..c507e71e0 100644
--- a/crates/ra_assists/src/utils/insert_use.rs
+++ b/crates/ra_assists/src/utils/insert_use.rs
@@ -1,4 +1,6 @@
1//! Handle syntactic aspects of inserting a new `use`. 1//! Handle syntactic aspects of inserting a new `use`.
2// FIXME: rewrite according to the plan, outlined in
3// https://github.com/rust-analyzer/rust-analyzer/issues/3301#issuecomment-592931553
2 4
3use hir::{self, ModPath}; 5use hir::{self, ModPath};
4use ra_syntax::{ 6use ra_syntax::{
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs
index 034fb7cfa..b71ee764a 100644
--- a/crates/ra_hir/src/code_model.rs
+++ b/crates/ra_hir/src/code_model.rs
@@ -229,8 +229,8 @@ impl Module {
229 } 229 }
230 } 230 }
231 231
232 for impl_block in self.impl_blocks(db) { 232 for impl_def in self.impl_defs(db) {
233 for item in impl_block.items(db) { 233 for item in impl_def.items(db) {
234 if let AssocItem::Function(f) = item { 234 if let AssocItem::Function(f) = item {
235 f.diagnostics(db, sink); 235 f.diagnostics(db, sink);
236 } 236 }
@@ -243,9 +243,9 @@ impl Module {
243 def_map[self.id.local_id].scope.declarations().map(ModuleDef::from).collect() 243 def_map[self.id.local_id].scope.declarations().map(ModuleDef::from).collect()
244 } 244 }
245 245
246 pub fn impl_blocks(self, db: &impl DefDatabase) -> Vec<ImplBlock> { 246 pub fn impl_defs(self, db: &impl DefDatabase) -> Vec<ImplDef> {
247 let def_map = db.crate_def_map(self.id.krate); 247 let def_map = db.crate_def_map(self.id.krate);
248 def_map[self.id.local_id].scope.impls().map(ImplBlock::from).collect() 248 def_map[self.id.local_id].scope.impls().map(ImplDef::from).collect()
249 } 249 }
250 250
251 pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module { 251 pub(crate) fn with_module_id(self, module_id: LocalModuleId) -> Module {
@@ -686,7 +686,7 @@ pub enum AssocItem {
686} 686}
687pub enum AssocItemContainer { 687pub enum AssocItemContainer {
688 Trait(Trait), 688 Trait(Trait),
689 ImplBlock(ImplBlock), 689 ImplDef(ImplDef),
690} 690}
691pub trait AsAssocItem { 691pub trait AsAssocItem {
692 fn as_assoc_item(self, db: &impl DefDatabase) -> Option<AssocItem>; 692 fn as_assoc_item(self, db: &impl DefDatabase) -> Option<AssocItem>;
@@ -736,7 +736,7 @@ impl AssocItem {
736 }; 736 };
737 match container { 737 match container {
738 AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()), 738 AssocContainerId::TraitId(id) => AssocItemContainer::Trait(id.into()),
739 AssocContainerId::ImplId(id) => AssocItemContainer::ImplBlock(id.into()), 739 AssocContainerId::ImplId(id) => AssocItemContainer::ImplDef(id.into()),
740 AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"), 740 AssocContainerId::ContainerId(_) => panic!("invalid AssocItem"),
741 } 741 }
742 } 742 }
@@ -748,7 +748,7 @@ pub enum GenericDef {
748 Adt(Adt), 748 Adt(Adt),
749 Trait(Trait), 749 Trait(Trait),
750 TypeAlias(TypeAlias), 750 TypeAlias(TypeAlias),
751 ImplBlock(ImplBlock), 751 ImplDef(ImplDef),
752 // enum variants cannot have generics themselves, but their parent enums 752 // enum variants cannot have generics themselves, but their parent enums
753 // can, and this makes some code easier to write 753 // can, and this makes some code easier to write
754 EnumVariant(EnumVariant), 754 EnumVariant(EnumVariant),
@@ -760,7 +760,7 @@ impl_froms!(
760 Adt(Struct, Enum, Union), 760 Adt(Struct, Enum, Union),
761 Trait, 761 Trait,
762 TypeAlias, 762 TypeAlias,
763 ImplBlock, 763 ImplDef,
764 EnumVariant, 764 EnumVariant,
765 Const 765 Const
766); 766);
@@ -850,20 +850,20 @@ impl TypeParam {
850 } 850 }
851} 851}
852 852
853// FIXME: rename from `ImplBlock` to `Impl` 853// FIXME: rename from `ImplDef` to `Impl`
854#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 854#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
855pub struct ImplBlock { 855pub struct ImplDef {
856 pub(crate) id: ImplId, 856 pub(crate) id: ImplId,
857} 857}
858 858
859impl ImplBlock { 859impl ImplDef {
860 pub fn all_in_crate(db: &impl HirDatabase, krate: Crate) -> Vec<ImplBlock> { 860 pub fn all_in_crate(db: &impl HirDatabase, krate: Crate) -> Vec<ImplDef> {
861 let impls = db.impls_in_crate(krate.id); 861 let impls = db.impls_in_crate(krate.id);
862 impls.all_impls().map(Self::from).collect() 862 impls.all_impls().map(Self::from).collect()
863 } 863 }
864 pub fn for_trait(db: &impl HirDatabase, krate: Crate, trait_: Trait) -> Vec<ImplBlock> { 864 pub fn for_trait(db: &impl HirDatabase, krate: Crate, trait_: Trait) -> Vec<ImplDef> {
865 let impls = db.impls_in_crate(krate.id); 865 let impls = db.impls_in_crate(krate.id);
866 impls.lookup_impl_blocks_for_trait(trait_.id).map(Self::from).collect() 866 impls.lookup_impl_defs_for_trait(trait_.id).map(Self::from).collect()
867 } 867 }
868 868
869 pub fn target_trait(&self, db: &impl DefDatabase) -> Option<TypeRef> { 869 pub fn target_trait(&self, db: &impl DefDatabase) -> Option<TypeRef> {
@@ -1077,7 +1077,7 @@ impl Type {
1077 } 1077 }
1078 1078
1079 // This would be nicer if it just returned an iterator, but that runs into 1079 // This would be nicer if it just returned an iterator, but that runs into
1080 // lifetime problems, because we need to borrow temp `CrateImplBlocks`. 1080 // lifetime problems, because we need to borrow temp `CrateImplDefs`.
1081 pub fn iterate_impl_items<T>( 1081 pub fn iterate_impl_items<T>(
1082 self, 1082 self,
1083 db: &impl HirDatabase, 1083 db: &impl HirDatabase,
@@ -1087,8 +1087,8 @@ impl Type {
1087 for krate in self.ty.value.def_crates(db, krate.id)? { 1087 for krate in self.ty.value.def_crates(db, krate.id)? {
1088 let impls = db.impls_in_crate(krate); 1088 let impls = db.impls_in_crate(krate);
1089 1089
1090 for impl_block in impls.lookup_impl_blocks(&self.ty.value) { 1090 for impl_def in impls.lookup_impl_defs(&self.ty.value) {
1091 for &item in db.impl_data(impl_block).items.iter() { 1091 for &item in db.impl_data(impl_def).items.iter() {
1092 if let Some(result) = callback(item.into()) { 1092 if let Some(result) = callback(item.into()) {
1093 return Some(result); 1093 return Some(result);
1094 } 1094 }
@@ -1196,7 +1196,7 @@ pub enum ScopeDef {
1196 ModuleDef(ModuleDef), 1196 ModuleDef(ModuleDef),
1197 MacroDef(MacroDef), 1197 MacroDef(MacroDef),
1198 GenericParam(TypeParam), 1198 GenericParam(TypeParam),
1199 ImplSelfType(ImplBlock), 1199 ImplSelfType(ImplDef),
1200 AdtSelfType(Adt), 1200 AdtSelfType(Adt),
1201 Local(Local), 1201 Local(Local),
1202 Unknown, 1202 Unknown,
diff --git a/crates/ra_hir/src/from_id.rs b/crates/ra_hir/src/from_id.rs
index cbfa91d6c..c179b13c6 100644
--- a/crates/ra_hir/src/from_id.rs
+++ b/crates/ra_hir/src/from_id.rs
@@ -39,7 +39,7 @@ from_id![
39 (hir_def::StaticId, crate::Static), 39 (hir_def::StaticId, crate::Static),
40 (hir_def::ConstId, crate::Const), 40 (hir_def::ConstId, crate::Const),
41 (hir_def::FunctionId, crate::Function), 41 (hir_def::FunctionId, crate::Function),
42 (hir_def::ImplId, crate::ImplBlock), 42 (hir_def::ImplId, crate::ImplDef),
43 (hir_def::TypeParamId, crate::TypeParam), 43 (hir_def::TypeParamId, crate::TypeParam),
44 (hir_expand::MacroDefId, crate::MacroDef) 44 (hir_expand::MacroDefId, crate::MacroDef)
45]; 45];
@@ -145,7 +145,7 @@ impl From<GenericDef> for GenericDefId {
145 GenericDef::Adt(it) => GenericDefId::AdtId(it.into()), 145 GenericDef::Adt(it) => GenericDefId::AdtId(it.into()),
146 GenericDef::Trait(it) => GenericDefId::TraitId(it.id), 146 GenericDef::Trait(it) => GenericDefId::TraitId(it.id),
147 GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id), 147 GenericDef::TypeAlias(it) => GenericDefId::TypeAliasId(it.id),
148 GenericDef::ImplBlock(it) => GenericDefId::ImplId(it.id), 148 GenericDef::ImplDef(it) => GenericDefId::ImplId(it.id),
149 GenericDef::EnumVariant(it) => { 149 GenericDef::EnumVariant(it) => {
150 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id }) 150 GenericDefId::EnumVariantId(EnumVariantId { parent: it.parent.id, local_id: it.id })
151 } 151 }
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 5541266e2..f121e1eff 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -9,7 +9,7 @@ use hir_def::{
9use ra_syntax::ast; 9use ra_syntax::ast;
10 10
11use crate::{ 11use crate::{
12 db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, ImplBlock, MacroDef, Module, 12 db::DefDatabase, Const, Enum, EnumVariant, FieldSource, Function, ImplDef, MacroDef, Module,
13 Static, Struct, StructField, Trait, TypeAlias, TypeParam, Union, 13 Static, Struct, StructField, Trait, TypeAlias, TypeParam, Union,
14}; 14};
15 15
@@ -111,9 +111,9 @@ impl HasSource for MacroDef {
111 } 111 }
112 } 112 }
113} 113}
114impl HasSource for ImplBlock { 114impl HasSource for ImplDef {
115 type Ast = ast::ImplBlock; 115 type Ast = ast::ImplDef;
116 fn source(self, db: &impl DefDatabase) -> InFile<ast::ImplBlock> { 116 fn source(self, db: &impl DefDatabase) -> InFile<ast::ImplDef> {
117 self.id.lookup(db).source(db) 117 self.id.lookup(db).source(db)
118 } 118 }
119} 119}
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs
index cefbd80e6..e1cb12cca 100644
--- a/crates/ra_hir/src/lib.rs
+++ b/crates/ra_hir/src/lib.rs
@@ -41,7 +41,7 @@ pub use crate::{
41 code_model::{ 41 code_model::{
42 Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency, 42 Adt, AsAssocItem, AssocItem, AssocItemContainer, AttrDef, Const, Crate, CrateDependency,
43 DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs, 43 DefWithBody, Docs, Enum, EnumVariant, FieldSource, Function, GenericDef, HasAttrs,
44 HasVisibility, ImplBlock, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct, 44 HasVisibility, ImplDef, Local, MacroDef, Module, ModuleDef, ScopeDef, Static, Struct,
45 StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef, 45 StructField, Trait, Type, TypeAlias, TypeParam, Union, VariantDef,
46 }, 46 },
47 has_source::HasSource, 47 has_source::HasSource,
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 74901e318..a0853957c 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -262,7 +262,7 @@ to_def_impls![
262 (crate::Enum, ast::EnumDef, enum_to_def), 262 (crate::Enum, ast::EnumDef, enum_to_def),
263 (crate::Union, ast::UnionDef, union_to_def), 263 (crate::Union, ast::UnionDef, union_to_def),
264 (crate::Trait, ast::TraitDef, trait_to_def), 264 (crate::Trait, ast::TraitDef, trait_to_def),
265 (crate::ImplBlock, ast::ImplBlock, impl_to_def), 265 (crate::ImplDef, ast::ImplDef, impl_to_def),
266 (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def), 266 (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def),
267 (crate::Const, ast::ConstDef, const_to_def), 267 (crate::Const, ast::ConstDef, const_to_def),
268 (crate::Static, ast::StaticDef, static_to_def), 268 (crate::Static, ast::StaticDef, static_to_def),
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs
index 884b535b2..67b243222 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -67,7 +67,7 @@ impl<DB: HirDatabase> SourceToDefCtx<'_, &'_ DB> {
67 pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> { 67 pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> {
68 self.to_def(src, keys::TRAIT) 68 self.to_def(src, keys::TRAIT)
69 } 69 }
70 pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplBlock>) -> Option<ImplId> { 70 pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> {
71 self.to_def(src, keys::IMPL) 71 self.to_def(src, keys::IMPL)
72 } 72 }
73 pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> { 73 pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> {
@@ -166,7 +166,7 @@ impl<DB: HirDatabase> SourceToDefCtx<'_, &'_ DB> {
166 let def = self.trait_to_def(container.with_value(it))?; 166 let def = self.trait_to_def(container.with_value(it))?;
167 def.into() 167 def.into()
168 }, 168 },
169 ast::ImplBlock(it) => { 169 ast::ImplDef(it) => {
170 let def = self.impl_to_def(container.with_value(it))?; 170 let def = self.impl_to_def(container.with_value(it))?;
171 def.into() 171 def.into()
172 }, 172 },
@@ -213,7 +213,7 @@ impl<DB: HirDatabase> SourceToDefCtx<'_, &'_ DB> {
213 ast::EnumDef(it) => { self.enum_to_def(container.with_value(it))?.into() }, 213 ast::EnumDef(it) => { self.enum_to_def(container.with_value(it))?.into() },
214 ast::TraitDef(it) => { self.trait_to_def(container.with_value(it))?.into() }, 214 ast::TraitDef(it) => { self.trait_to_def(container.with_value(it))?.into() },
215 ast::TypeAliasDef(it) => { self.type_alias_to_def(container.with_value(it))?.into() }, 215 ast::TypeAliasDef(it) => { self.type_alias_to_def(container.with_value(it))?.into() },
216 ast::ImplBlock(it) => { self.impl_to_def(container.with_value(it))?.into() }, 216 ast::ImplDef(it) => { self.impl_to_def(container.with_value(it))?.into() },
217 _ => continue, 217 _ => continue,
218 } 218 }
219 }; 219 };
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs
index c650a9e08..4c121eb73 100644
--- a/crates/ra_hir/src/source_analyzer.rs
+++ b/crates/ra_hir/src/source_analyzer.rs
@@ -49,7 +49,7 @@ pub enum PathResolution {
49 Local(Local), 49 Local(Local),
50 /// A generic parameter 50 /// A generic parameter
51 TypeParam(TypeParam), 51 TypeParam(TypeParam),
52 SelfType(crate::ImplBlock), 52 SelfType(crate::ImplDef),
53 Macro(MacroDef), 53 Macro(MacroDef),
54 AssocItem(crate::AssocItem), 54 AssocItem(crate::AssocItem),
55} 55}
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index b3fb6d452..c18e6879b 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -544,7 +544,7 @@ where
544 let ast_id = self.expander.ast_id(&def); 544 let ast_id = self.expander.ast_id(&def);
545 (TraitLoc { container, ast_id }.intern(self.db).into(), def.name()) 545 (TraitLoc { container, ast_id }.intern(self.db).into(), def.name())
546 } 546 }
547 ast::ModuleItem::ImplBlock(_) 547 ast::ModuleItem::ImplDef(_)
548 | ast::ModuleItem::UseItem(_) 548 | ast::ModuleItem::UseItem(_)
549 | ast::ModuleItem::ExternCrateItem(_) 549 | ast::ModuleItem::ExternCrateItem(_)
550 | ast::ModuleItem::Module(_) => continue, 550 | ast::ModuleItem::Module(_) => continue,
diff --git a/crates/ra_hir_def/src/data.rs b/crates/ra_hir_def/src/data.rs
index c900a6a18..c5fb9428e 100644
--- a/crates/ra_hir_def/src/data.rs
+++ b/crates/ra_hir_def/src/data.rs
@@ -238,16 +238,16 @@ impl ConstData {
238fn collect_impl_items_in_macros( 238fn collect_impl_items_in_macros(
239 db: &impl DefDatabase, 239 db: &impl DefDatabase,
240 module_id: ModuleId, 240 module_id: ModuleId,
241 impl_block: &InFile<ast::ItemList>, 241 impl_def: &InFile<ast::ItemList>,
242 id: ImplId, 242 id: ImplId,
243) -> Vec<AssocItemId> { 243) -> Vec<AssocItemId> {
244 let mut expander = Expander::new(db, impl_block.file_id, module_id); 244 let mut expander = Expander::new(db, impl_def.file_id, module_id);
245 let mut res = Vec::new(); 245 let mut res = Vec::new();
246 246
247 // We set a limit to protect against infinite recursion 247 // We set a limit to protect against infinite recursion
248 let limit = 100; 248 let limit = 100;
249 249
250 for m in impl_block.value.syntax().children().filter_map(ast::MacroCall::cast) { 250 for m in impl_def.value.syntax().children().filter_map(ast::MacroCall::cast) {
251 res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit)) 251 res.extend(collect_impl_items_in_macro(db, &mut expander, m, id, limit))
252 } 252 }
253 253
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs
index 5913f12b1..8cd70eb9a 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -18,7 +18,7 @@ pub const FUNCTION: Key<ast::FnDef, FunctionId> = Key::new();
18pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); 18pub const CONST: Key<ast::ConstDef, ConstId> = Key::new();
19pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); 19pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new();
20pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new(); 20pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new();
21pub const IMPL: Key<ast::ImplBlock, ImplId> = Key::new(); 21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); 22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
23pub const STRUCT: Key<ast::StructDef, StructId> = Key::new(); 23pub const STRUCT: Key<ast::StructDef, StructId> = Key::new();
24pub const UNION: Key<ast::UnionDef, UnionId> = Key::new(); 24pub const UNION: Key<ast::UnionDef, UnionId> = Key::new();
diff --git a/crates/ra_hir_def/src/lang_item.rs b/crates/ra_hir_def/src/lang_item.rs
index 37c861a87..5a336ea1f 100644
--- a/crates/ra_hir_def/src/lang_item.rs
+++ b/crates/ra_hir_def/src/lang_item.rs
@@ -16,7 +16,7 @@ use crate::{
16pub enum LangItemTarget { 16pub enum LangItemTarget {
17 EnumId(EnumId), 17 EnumId(EnumId),
18 FunctionId(FunctionId), 18 FunctionId(FunctionId),
19 ImplBlockId(ImplId), 19 ImplDefId(ImplId),
20 StaticId(StaticId), 20 StaticId(StaticId),
21 StructId(StructId), 21 StructId(StructId),
22 TraitId(TraitId), 22 TraitId(TraitId),
@@ -37,9 +37,9 @@ impl LangItemTarget {
37 } 37 }
38 } 38 }
39 39
40 pub fn as_impl_block(self) -> Option<ImplId> { 40 pub fn as_impl_def(self) -> Option<ImplId> {
41 match self { 41 match self {
42 LangItemTarget::ImplBlockId(id) => Some(id), 42 LangItemTarget::ImplDefId(id) => Some(id),
43 _ => None, 43 _ => None,
44 } 44 }
45 } 45 }
@@ -125,8 +125,8 @@ impl LangItems {
125 // Look for impl targets 125 // Look for impl targets
126 let def_map = db.crate_def_map(module.krate); 126 let def_map = db.crate_def_map(module.krate);
127 let module_data = &def_map[module.local_id]; 127 let module_data = &def_map[module.local_id];
128 for impl_block in module_data.scope.impls() { 128 for impl_def in module_data.scope.impls() {
129 self.collect_lang_item(db, impl_block, LangItemTarget::ImplBlockId) 129 self.collect_lang_item(db, impl_def, LangItemTarget::ImplDefId)
130 } 130 }
131 131
132 for def in module_data.scope.declarations() { 132 for def in module_data.scope.declarations() {
diff --git a/crates/ra_hir_def/src/lib.rs b/crates/ra_hir_def/src/lib.rs
index 564b5fec5..c9b14d0c8 100644
--- a/crates/ra_hir_def/src/lib.rs
+++ b/crates/ra_hir_def/src/lib.rs
@@ -164,7 +164,7 @@ impl_intern!(TypeAliasId, TypeAliasLoc, intern_type_alias, lookup_intern_type_al
164 164
165#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 165#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
166pub struct ImplId(salsa::InternId); 166pub struct ImplId(salsa::InternId);
167type ImplLoc = ItemLoc<ast::ImplBlock>; 167type ImplLoc = ItemLoc<ast::ImplDef>;
168impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl); 168impl_intern!(ImplId, ImplLoc, intern_impl, lookup_intern_impl);
169 169
170#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 170#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs
index 0e8c9da76..ea3c00da8 100644
--- a/crates/ra_hir_def/src/nameres/raw.rs
+++ b/crates/ra_hir_def/src/nameres/raw.rs
@@ -213,7 +213,7 @@ impl_arena_id!(Impl);
213 213
214#[derive(Debug, PartialEq, Eq)] 214#[derive(Debug, PartialEq, Eq)]
215pub(super) struct ImplData { 215pub(super) struct ImplData {
216 pub(super) ast_id: FileAstId<ast::ImplBlock>, 216 pub(super) ast_id: FileAstId<ast::ImplDef>,
217} 217}
218 218
219struct RawItemsCollector { 219struct RawItemsCollector {
@@ -249,7 +249,7 @@ impl RawItemsCollector {
249 self.add_extern_crate_item(current_module, extern_crate); 249 self.add_extern_crate_item(current_module, extern_crate);
250 return; 250 return;
251 } 251 }
252 ast::ModuleItem::ImplBlock(it) => { 252 ast::ModuleItem::ImplDef(it) => {
253 self.add_impl(current_module, it); 253 self.add_impl(current_module, it);
254 return; 254 return;
255 } 255 }
@@ -395,7 +395,7 @@ impl RawItemsCollector {
395 self.push_item(current_module, attrs, RawItemKind::Macro(m)); 395 self.push_item(current_module, attrs, RawItemKind::Macro(m));
396 } 396 }
397 397
398 fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplBlock) { 398 fn add_impl(&mut self, current_module: Option<Module>, imp: ast::ImplDef) {
399 let attrs = self.parse_attrs(&imp); 399 let attrs = self.parse_attrs(&imp);
400 let ast_id = self.source_ast_id_map.ast_id(&imp); 400 let ast_id = self.source_ast_id_map.ast_id(&imp);
401 let imp = self.raw_items.impls.alloc(ImplData { ast_id }); 401 let imp = self.raw_items.impls.alloc(ImplData { ast_id });
diff --git a/crates/ra_hir_def/src/resolver.rs b/crates/ra_hir_def/src/resolver.rs
index 9dd4fa555..2734d51a0 100644
--- a/crates/ra_hir_def/src/resolver.rs
+++ b/crates/ra_hir_def/src/resolver.rs
@@ -52,7 +52,7 @@ enum Scope {
52 /// Brings the generic parameters of an item into scope 52 /// Brings the generic parameters of an item into scope
53 GenericParams { def: GenericDefId, params: Arc<GenericParams> }, 53 GenericParams { def: GenericDefId, params: Arc<GenericParams> },
54 /// Brings `Self` in `impl` block into scope 54 /// Brings `Self` in `impl` block into scope
55 ImplBlockScope(ImplId), 55 ImplDefScope(ImplId),
56 /// Brings `Self` in enum, struct and union definitions into scope 56 /// Brings `Self` in enum, struct and union definitions into scope
57 AdtScope(AdtId), 57 AdtScope(AdtId),
58 /// Local bindings 58 /// Local bindings
@@ -154,7 +154,7 @@ impl Resolver {
154 match scope { 154 match scope {
155 Scope::ExprScope(_) => continue, 155 Scope::ExprScope(_) => continue,
156 Scope::GenericParams { .. } 156 Scope::GenericParams { .. }
157 | Scope::ImplBlockScope(_) 157 | Scope::ImplDefScope(_)
158 | Scope::LocalItemsScope(_) 158 | Scope::LocalItemsScope(_)
159 if skip_to_mod => 159 if skip_to_mod =>
160 { 160 {
@@ -170,7 +170,7 @@ impl Resolver {
170 )); 170 ));
171 } 171 }
172 } 172 }
173 Scope::ImplBlockScope(impl_) => { 173 Scope::ImplDefScope(impl_) => {
174 if first_name == &name![Self] { 174 if first_name == &name![Self] {
175 let idx = if path.segments.len() == 1 { None } else { Some(1) }; 175 let idx = if path.segments.len() == 1 { None } else { Some(1) };
176 return Some((TypeNs::SelfType(*impl_), idx)); 176 return Some((TypeNs::SelfType(*impl_), idx));
@@ -263,7 +263,7 @@ impl Resolver {
263 Scope::AdtScope(_) 263 Scope::AdtScope(_)
264 | Scope::ExprScope(_) 264 | Scope::ExprScope(_)
265 | Scope::GenericParams { .. } 265 | Scope::GenericParams { .. }
266 | Scope::ImplBlockScope(_) 266 | Scope::ImplDefScope(_)
267 | Scope::LocalItemsScope(_) 267 | Scope::LocalItemsScope(_)
268 if skip_to_mod => 268 if skip_to_mod =>
269 { 269 {
@@ -291,7 +291,7 @@ impl Resolver {
291 } 291 }
292 Scope::GenericParams { .. } => continue, 292 Scope::GenericParams { .. } => continue,
293 293
294 Scope::ImplBlockScope(impl_) if n_segments > 1 => { 294 Scope::ImplDefScope(impl_) if n_segments > 1 => {
295 if first_name == &name![Self] { 295 if first_name == &name![Self] {
296 let ty = TypeNs::SelfType(*impl_); 296 let ty = TypeNs::SelfType(*impl_);
297 return Some(ResolveValueResult::Partial(ty, 1)); 297 return Some(ResolveValueResult::Partial(ty, 1));
@@ -303,7 +303,7 @@ impl Resolver {
303 return Some(ResolveValueResult::Partial(ty, 1)); 303 return Some(ResolveValueResult::Partial(ty, 1));
304 } 304 }
305 } 305 }
306 Scope::ImplBlockScope(_) | Scope::AdtScope(_) => continue, 306 Scope::ImplDefScope(_) | Scope::AdtScope(_) => continue,
307 307
308 Scope::ModuleScope(m) => { 308 Scope::ModuleScope(m) => {
309 let (module_def, idx) = m.crate_def_map.resolve_path( 309 let (module_def, idx) = m.crate_def_map.resolve_path(
@@ -503,7 +503,7 @@ impl Scope {
503 } 503 }
504 } 504 }
505 } 505 }
506 Scope::ImplBlockScope(i) => { 506 Scope::ImplDefScope(i) => {
507 f(name![Self], ScopeDef::ImplSelfType(*i)); 507 f(name![Self], ScopeDef::ImplSelfType(*i));
508 } 508 }
509 Scope::AdtScope(i) => { 509 Scope::AdtScope(i) => {
@@ -550,8 +550,8 @@ impl Resolver {
550 self.push_scope(Scope::GenericParams { def, params }) 550 self.push_scope(Scope::GenericParams { def, params })
551 } 551 }
552 552
553 fn push_impl_block_scope(self, impl_block: ImplId) -> Resolver { 553 fn push_impl_def_scope(self, impl_def: ImplId) -> Resolver {
554 self.push_scope(Scope::ImplBlockScope(impl_block)) 554 self.push_scope(Scope::ImplDefScope(impl_def))
555 } 555 }
556 556
557 fn push_module_scope( 557 fn push_module_scope(
@@ -634,7 +634,7 @@ impl HasResolver for ImplId {
634 .container 634 .container
635 .resolver(db) 635 .resolver(db)
636 .push_generic_params_scope(db, self.into()) 636 .push_generic_params_scope(db, self.into())
637 .push_impl_block_scope(self) 637 .push_impl_def_scope(self)
638 } 638 }
639} 639}
640 640
diff --git a/crates/ra_hir_ty/src/db.rs b/crates/ra_hir_ty/src/db.rs
index e9bfcfa17..85d85182f 100644
--- a/crates/ra_hir_ty/src/db.rs
+++ b/crates/ra_hir_ty/src/db.rs
@@ -11,7 +11,7 @@ use ra_db::{impl_intern_key, salsa, CrateId};
11use ra_prof::profile; 11use ra_prof::profile;
12 12
13use crate::{ 13use crate::{
14 method_resolution::CrateImplBlocks, 14 method_resolution::CrateImplDefs,
15 traits::{chalk, AssocTyValue, Impl}, 15 traits::{chalk, AssocTyValue, Impl},
16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty, 16 Binders, CallableDef, GenericPredicate, InferenceResult, PolyFnSig, Substs, TraitRef, Ty,
17 TyDefId, TypeCtor, ValueTyDefId, 17 TyDefId, TypeCtor, ValueTyDefId,
@@ -59,8 +59,8 @@ pub trait HirDatabase: DefDatabase {
59 #[salsa::invoke(crate::lower::generic_defaults_query)] 59 #[salsa::invoke(crate::lower::generic_defaults_query)]
60 fn generic_defaults(&self, def: GenericDefId) -> Substs; 60 fn generic_defaults(&self, def: GenericDefId) -> Substs;
61 61
62 #[salsa::invoke(crate::method_resolution::CrateImplBlocks::impls_in_crate_query)] 62 #[salsa::invoke(crate::method_resolution::CrateImplDefs::impls_in_crate_query)]
63 fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplBlocks>; 63 fn impls_in_crate(&self, krate: CrateId) -> Arc<CrateImplDefs>;
64 64
65 #[salsa::invoke(crate::traits::impls_for_trait_query)] 65 #[salsa::invoke(crate::traits::impls_for_trait_query)]
66 fn impls_for_trait(&self, krate: CrateId, trait_: TraitId) -> Arc<[ImplId]>; 66 fn impls_for_trait(&self, krate: CrateId, trait_: TraitId) -> Arc<[ImplId]>;
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs
index 988d83af5..df5901835 100644
--- a/crates/ra_hir_ty/src/method_resolution.rs
+++ b/crates/ra_hir_ty/src/method_resolution.rs
@@ -42,19 +42,19 @@ impl TyFingerprint {
42} 42}
43 43
44#[derive(Debug, PartialEq, Eq)] 44#[derive(Debug, PartialEq, Eq)]
45pub struct CrateImplBlocks { 45pub struct CrateImplDefs {
46 impls: FxHashMap<TyFingerprint, Vec<ImplId>>, 46 impls: FxHashMap<TyFingerprint, Vec<ImplId>>,
47 impls_by_trait: FxHashMap<TraitId, Vec<ImplId>>, 47 impls_by_trait: FxHashMap<TraitId, Vec<ImplId>>,
48} 48}
49 49
50impl CrateImplBlocks { 50impl CrateImplDefs {
51 pub(crate) fn impls_in_crate_query( 51 pub(crate) fn impls_in_crate_query(
52 db: &impl HirDatabase, 52 db: &impl HirDatabase,
53 krate: CrateId, 53 krate: CrateId,
54 ) -> Arc<CrateImplBlocks> { 54 ) -> Arc<CrateImplDefs> {
55 let _p = profile("impls_in_crate_query"); 55 let _p = profile("impls_in_crate_query");
56 let mut res = 56 let mut res =
57 CrateImplBlocks { impls: FxHashMap::default(), impls_by_trait: FxHashMap::default() }; 57 CrateImplDefs { impls: FxHashMap::default(), impls_by_trait: FxHashMap::default() };
58 58
59 let crate_def_map = db.crate_def_map(krate); 59 let crate_def_map = db.crate_def_map(krate);
60 for (_module_id, module_data) in crate_def_map.modules.iter() { 60 for (_module_id, module_data) in crate_def_map.modules.iter() {
@@ -75,12 +75,12 @@ impl CrateImplBlocks {
75 75
76 Arc::new(res) 76 Arc::new(res)
77 } 77 }
78 pub fn lookup_impl_blocks(&self, ty: &Ty) -> impl Iterator<Item = ImplId> + '_ { 78 pub fn lookup_impl_defs(&self, ty: &Ty) -> impl Iterator<Item = ImplId> + '_ {
79 let fingerprint = TyFingerprint::for_impl(ty); 79 let fingerprint = TyFingerprint::for_impl(ty);
80 fingerprint.and_then(|f| self.impls.get(&f)).into_iter().flatten().copied() 80 fingerprint.and_then(|f| self.impls.get(&f)).into_iter().flatten().copied()
81 } 81 }
82 82
83 pub fn lookup_impl_blocks_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ { 83 pub fn lookup_impl_defs_for_trait(&self, tr: TraitId) -> impl Iterator<Item = ImplId> + '_ {
84 self.impls_by_trait.get(&tr).into_iter().flatten().copied() 84 self.impls_by_trait.get(&tr).into_iter().flatten().copied()
85 } 85 }
86 86
@@ -131,7 +131,7 @@ impl Ty {
131 let res = lang_item_targets 131 let res = lang_item_targets
132 .into_iter() 132 .into_iter()
133 .filter_map(|it| match it { 133 .filter_map(|it| match it {
134 LangItemTarget::ImplBlockId(it) => Some(it), 134 LangItemTarget::ImplDefId(it) => Some(it),
135 _ => None, 135 _ => None,
136 }) 136 })
137 .map(|it| it.lookup(db).container.module(db).krate) 137 .map(|it| it.lookup(db).container.module(db).krate)
@@ -177,7 +177,7 @@ pub enum LookupMode {
177} 177}
178 178
179// This would be nicer if it just returned an iterator, but that runs into 179// This would be nicer if it just returned an iterator, but that runs into
180// lifetime problems, because we need to borrow temp `CrateImplBlocks`. 180// lifetime problems, because we need to borrow temp `CrateImplDefs`.
181// FIXME add a context type here? 181// FIXME add a context type here?
182pub fn iterate_method_candidates<T>( 182pub fn iterate_method_candidates<T>(
183 ty: &Canonical<Ty>, 183 ty: &Canonical<Ty>,
@@ -425,8 +425,8 @@ fn iterate_inherent_methods<T>(
425 for krate in self_ty.value.def_crates(db, krate)? { 425 for krate in self_ty.value.def_crates(db, krate)? {
426 let impls = db.impls_in_crate(krate); 426 let impls = db.impls_in_crate(krate);
427 427
428 for impl_block in impls.lookup_impl_blocks(&self_ty.value) { 428 for impl_def in impls.lookup_impl_defs(&self_ty.value) {
429 for &item in db.impl_data(impl_block).items.iter() { 429 for &item in db.impl_data(impl_def).items.iter() {
430 if !is_valid_candidate(db, name, receiver_ty, item, self_ty) { 430 if !is_valid_candidate(db, name, receiver_ty, item, self_ty) {
431 continue; 431 continue;
432 } 432 }
@@ -434,8 +434,7 @@ fn iterate_inherent_methods<T>(
434 // that the impl is for. If we have a receiver type, this 434 // that the impl is for. If we have a receiver type, this
435 // already happens in `is_valid_candidate` above; if not, we 435 // already happens in `is_valid_candidate` above; if not, we
436 // check it here 436 // check it here
437 if receiver_ty.is_none() && inherent_impl_substs(db, impl_block, self_ty).is_none() 437 if receiver_ty.is_none() && inherent_impl_substs(db, impl_def, self_ty).is_none() {
438 {
439 test_utils::tested_by!(impl_self_type_match_without_receiver); 438 test_utils::tested_by!(impl_self_type_match_without_receiver);
440 continue; 439 continue;
441 } 440 }
diff --git a/crates/ra_hir_ty/src/tests/macros.rs b/crates/ra_hir_ty/src/tests/macros.rs
index 652420ea8..53cd81d46 100644
--- a/crates/ra_hir_ty/src/tests/macros.rs
+++ b/crates/ra_hir_ty/src/tests/macros.rs
@@ -4,7 +4,7 @@ use insta::assert_snapshot;
4use ra_db::fixture::WithFixture; 4use ra_db::fixture::WithFixture;
5 5
6#[test] 6#[test]
7fn cfg_impl_block() { 7fn cfg_impl_def() {
8 let (db, pos) = TestDB::with_position( 8 let (db, pos) = TestDB::with_position(
9 r#" 9 r#"
10//- /main.rs crate:main deps:foo cfg:test 10//- /main.rs crate:main deps:foo cfg:test
@@ -347,17 +347,17 @@ mod m {
347m::foo!(foo); 347m::foo!(foo);
348use foo as bar; 348use foo as bar;
349fn f() -> bar { 0 } 349fn f() -> bar { 0 }
350fn main() { 350fn main() {
351 let _a = f(); 351 let _a = f();
352} 352}
353"#), 353"#),
354 @r###" 354 @r###"
355 [159; 164) '{ 0 }': u64 355 [159; 164) '{ 0 }': u64
356 [161; 162) '0': u64 356 [161; 162) '0': u64
357 [175; 199) '{ ...f(); }': () 357 [175; 197) '{ ...f(); }': ()
358 [187; 189) '_a': u64 358 [185; 187) '_a': u64
359 [193; 194) 'f': fn f() -> u64 359 [191; 192) 'f': fn f() -> u64
360 [193; 196) 'f()': u64 360 [191; 194) 'f()': u64
361 "### 361 "###
362 ); 362 );
363} 363}
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs
index 17aef9490..bc6ee2600 100644
--- a/crates/ra_hir_ty/src/traits.rs
+++ b/crates/ra_hir_ty/src/traits.rs
@@ -131,8 +131,8 @@ pub(crate) fn impls_for_trait_query(
131 for dep in db.crate_graph().dependencies(krate) { 131 for dep in db.crate_graph().dependencies(krate) {
132 impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter()); 132 impls.extend(db.impls_for_trait(dep.crate_id, trait_).iter());
133 } 133 }
134 let crate_impl_blocks = db.impls_in_crate(krate); 134 let crate_impl_defs = db.impls_in_crate(krate);
135 impls.extend(crate_impl_blocks.lookup_impl_blocks_for_trait(trait_)); 135 impls.extend(crate_impl_defs.lookup_impl_defs_for_trait(trait_));
136 impls.into_iter().collect() 136 impls.into_iter().collect()
137} 137}
138 138
@@ -346,7 +346,7 @@ pub struct UnsizeToSuperTraitObjectData {
346#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 346#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
347pub enum Impl { 347pub enum Impl {
348 /// A normal impl from an impl block. 348 /// A normal impl from an impl block.
349 ImplBlock(ImplId), 349 ImplDef(ImplId),
350 /// Closure types implement the Fn traits synthetically. 350 /// Closure types implement the Fn traits synthetically.
351 ClosureFnTraitImpl(ClosureFnTraitImplData), 351 ClosureFnTraitImpl(ClosureFnTraitImplData),
352 /// [T; n]: Unsize<[T]> 352 /// [T; n]: Unsize<[T]>
diff --git a/crates/ra_hir_ty/src/traits/builtin.rs b/crates/ra_hir_ty/src/traits/builtin.rs
index cc0f3eeb4..03f9b4e27 100644
--- a/crates/ra_hir_ty/src/traits/builtin.rs
+++ b/crates/ra_hir_ty/src/traits/builtin.rs
@@ -96,7 +96,7 @@ fn get_builtin_unsize_impls(
96 96
97pub(super) fn impl_datum(db: &impl HirDatabase, krate: CrateId, impl_: Impl) -> BuiltinImplData { 97pub(super) fn impl_datum(db: &impl HirDatabase, krate: CrateId, impl_: Impl) -> BuiltinImplData {
98 match impl_ { 98 match impl_ {
99 Impl::ImplBlock(_) => unreachable!(), 99 Impl::ImplDef(_) => unreachable!(),
100 Impl::ClosureFnTraitImpl(data) => closure_fn_trait_impl_datum(db, krate, data), 100 Impl::ClosureFnTraitImpl(data) => closure_fn_trait_impl_datum(db, krate, data),
101 Impl::UnsizeArray => array_unsize_impl_datum(db, krate), 101 Impl::UnsizeArray => array_unsize_impl_datum(db, krate),
102 Impl::UnsizeToTraitObject(trait_) => trait_object_unsize_impl_datum(db, krate, trait_), 102 Impl::UnsizeToTraitObject(trait_) => trait_object_unsize_impl_datum(db, krate, trait_),
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs
index 5b6c1a62e..4001aa941 100644
--- a/crates/ra_hir_ty/src/traits/chalk.rs
+++ b/crates/ra_hir_ty/src/traits/chalk.rs
@@ -576,7 +576,7 @@ where
576 .impls_for_trait(self.krate, trait_) 576 .impls_for_trait(self.krate, trait_)
577 .iter() 577 .iter()
578 .copied() 578 .copied()
579 .map(Impl::ImplBlock) 579 .map(Impl::ImplDef)
580 .map(|impl_| impl_.to_chalk(self.db)) 580 .map(|impl_| impl_.to_chalk(self.db))
581 .collect(); 581 .collect();
582 582
@@ -712,12 +712,12 @@ pub(crate) fn impl_datum_query(
712 debug!("impl_datum {:?}", impl_id); 712 debug!("impl_datum {:?}", impl_id);
713 let impl_: Impl = from_chalk(db, impl_id); 713 let impl_: Impl = from_chalk(db, impl_id);
714 match impl_ { 714 match impl_ {
715 Impl::ImplBlock(impl_block) => impl_block_datum(db, krate, impl_id, impl_block), 715 Impl::ImplDef(impl_def) => impl_def_datum(db, krate, impl_id, impl_def),
716 _ => Arc::new(builtin::impl_datum(db, krate, impl_).to_chalk(db)), 716 _ => Arc::new(builtin::impl_datum(db, krate, impl_).to_chalk(db)),
717 } 717 }
718} 718}
719 719
720fn impl_block_datum( 720fn impl_def_datum(
721 db: &impl HirDatabase, 721 db: &impl HirDatabase,
722 krate: CrateId, 722 krate: CrateId,
723 chalk_id: ImplId, 723 chalk_id: ImplId,
@@ -815,7 +815,7 @@ fn type_alias_associated_ty_value(
815 let ty = db.ty(type_alias.into()); 815 let ty = db.ty(type_alias.into());
816 let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) }; 816 let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.value.to_chalk(db) };
817 let value = chalk_rust_ir::AssociatedTyValue { 817 let value = chalk_rust_ir::AssociatedTyValue {
818 impl_id: Impl::ImplBlock(impl_id).to_chalk(db), 818 impl_id: Impl::ImplDef(impl_id).to_chalk(db),
819 associated_ty_id: assoc_ty.to_chalk(db), 819 associated_ty_id: assoc_ty.to_chalk(db),
820 value: make_binders(value_bound, ty.num_binders), 820 value: make_binders(value_bound, ty.num_binders),
821 }; 821 };
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index 9a27c164b..18a1d2995 100644
--- a/crates/ra_ide/src/completion/complete_trait_impl.rs
+++ b/crates/ra_ide/src/completion/complete_trait_impl.rs
@@ -3,7 +3,7 @@
3//! This module adds the completion items related to implementing associated 3//! This module adds the completion items related to implementing associated
4//! items within a `impl Trait for Struct` block. The current context node 4//! items within a `impl Trait for Struct` block. The current context node
5//! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node 5//! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node
6//! and an direct child of an `IMPL_BLOCK`. 6//! and an direct child of an `IMPL_DEF`.
7//! 7//!
8//! # Examples 8//! # Examples
9//! 9//!
@@ -55,49 +55,43 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
55 _ => false, 55 _ => false,
56 }); 56 });
57 57
58 let impl_block = trigger 58 let impl_def = trigger
59 .as_ref() 59 .as_ref()
60 .and_then(|node| node.parent()) 60 .and_then(|node| node.parent())
61 .and_then(|node| node.parent()) 61 .and_then(|node| node.parent())
62 .and_then(ast::ImplBlock::cast); 62 .and_then(ast::ImplDef::cast);
63 63
64 if let (Some(trigger), Some(impl_block)) = (trigger, impl_block) { 64 if let (Some(trigger), Some(impl_def)) = (trigger, impl_def) {
65 match trigger.kind() { 65 match trigger.kind() {
66 SyntaxKind::FN_DEF => { 66 SyntaxKind::FN_DEF => {
67 for missing_fn in 67 for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
68 get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| { 68 |item| match item {
69 match item { 69 hir::AssocItem::Function(fn_item) => Some(fn_item),
70 hir::AssocItem::Function(fn_item) => Some(fn_item), 70 _ => None,
71 _ => None, 71 },
72 } 72 ) {
73 })
74 {
75 add_function_impl(&trigger, acc, ctx, &missing_fn); 73 add_function_impl(&trigger, acc, ctx, &missing_fn);
76 } 74 }
77 } 75 }
78 76
79 SyntaxKind::TYPE_ALIAS_DEF => { 77 SyntaxKind::TYPE_ALIAS_DEF => {
80 for missing_fn in 78 for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
81 get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| { 79 |item| match item {
82 match item { 80 hir::AssocItem::TypeAlias(type_item) => Some(type_item),
83 hir::AssocItem::TypeAlias(type_item) => Some(type_item), 81 _ => None,
84 _ => None, 82 },
85 } 83 ) {
86 })
87 {
88 add_type_alias_impl(&trigger, acc, ctx, &missing_fn); 84 add_type_alias_impl(&trigger, acc, ctx, &missing_fn);
89 } 85 }
90 } 86 }
91 87
92 SyntaxKind::CONST_DEF => { 88 SyntaxKind::CONST_DEF => {
93 for missing_fn in 89 for missing_fn in get_missing_impl_items(&ctx.sema, &impl_def).iter().filter_map(
94 get_missing_impl_items(&ctx.sema, &impl_block).iter().filter_map(|item| { 90 |item| match item {
95 match item { 91 hir::AssocItem::Const(const_item) => Some(const_item),
96 hir::AssocItem::Const(const_item) => Some(const_item), 92 _ => None,
97 _ => None, 93 },
98 } 94 ) {
99 })
100 {
101 add_const_impl(&trigger, acc, ctx, &missing_fn); 95 add_const_impl(&trigger, acc, ctx, &missing_fn);
102 } 96 }
103 } 97 }
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 81321a897..9aa5a705d 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -27,7 +27,7 @@ pub(crate) struct CompletionContext<'a> {
27 pub(super) use_item_syntax: Option<ast::UseItem>, 27 pub(super) use_item_syntax: Option<ast::UseItem>,
28 pub(super) record_lit_syntax: Option<ast::RecordLit>, 28 pub(super) record_lit_syntax: Option<ast::RecordLit>,
29 pub(super) record_lit_pat: Option<ast::RecordPat>, 29 pub(super) record_lit_pat: Option<ast::RecordPat>,
30 pub(super) impl_block: Option<ast::ImplBlock>, 30 pub(super) impl_def: Option<ast::ImplDef>,
31 pub(super) is_param: bool, 31 pub(super) is_param: bool,
32 /// If a name-binding or reference to a const in a pattern. 32 /// If a name-binding or reference to a const in a pattern.
33 /// Irrefutable patterns (like let) are excluded. 33 /// Irrefutable patterns (like let) are excluded.
@@ -81,7 +81,7 @@ impl<'a> CompletionContext<'a> {
81 use_item_syntax: None, 81 use_item_syntax: None,
82 record_lit_syntax: None, 82 record_lit_syntax: None,
83 record_lit_pat: None, 83 record_lit_pat: None,
84 impl_block: None, 84 impl_def: None,
85 is_param: false, 85 is_param: false,
86 is_pat_binding: false, 86 is_pat_binding: false,
87 is_trivial_path: false, 87 is_trivial_path: false,
@@ -161,12 +161,12 @@ impl<'a> CompletionContext<'a> {
161 self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset); 161 self.record_lit_syntax = find_node_at_offset(original_file.syntax(), self.offset);
162 } 162 }
163 163
164 self.impl_block = self 164 self.impl_def = self
165 .token 165 .token
166 .parent() 166 .parent()
167 .ancestors() 167 .ancestors()
168 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) 168 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
169 .find_map(ast::ImplBlock::cast); 169 .find_map(ast::ImplDef::cast);
170 170
171 let top_node = name_ref 171 let top_node = name_ref
172 .syntax() 172 .syntax()
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 5afb23764..4d3dd477e 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -269,7 +269,7 @@ impl ToNav for hir::Module {
269 } 269 }
270} 270}
271 271
272impl ToNav for hir::ImplBlock { 272impl ToNav for hir::ImplDef {
273 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget { 273 fn to_nav(&self, db: &RootDatabase) -> NavigationTarget {
274 let src = self.source(db); 274 let src = self.source(db);
275 let frange = if let Some(item) = self.is_builtin_derive(db) { 275 let frange = if let Some(item) = self.is_builtin_derive(db) {
diff --git a/crates/ra_ide/src/display/structure.rs b/crates/ra_ide/src/display/structure.rs
index 944cc79df..5774e9a8b 100644
--- a/crates/ra_ide/src/display/structure.rs
+++ b/crates/ra_ide/src/display/structure.rs
@@ -129,7 +129,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
129 ast::RecordFieldDef(it) => { decl_with_ascription(it) }, 129 ast::RecordFieldDef(it) => { decl_with_ascription(it) },
130 ast::ConstDef(it) => { decl_with_ascription(it) }, 130 ast::ConstDef(it) => { decl_with_ascription(it) },
131 ast::StaticDef(it) => { decl_with_ascription(it) }, 131 ast::StaticDef(it) => { decl_with_ascription(it) },
132 ast::ImplBlock(it) => { 132 ast::ImplDef(it) => {
133 let target_type = it.target_type()?; 133 let target_type = it.target_type()?;
134 let target_trait = it.target_trait(); 134 let target_trait = it.target_trait();
135 let label = match target_trait { 135 let label = match target_trait {
@@ -360,7 +360,7 @@ fn very_obsolete() {}
360 label: "impl E", 360 label: "impl E",
361 navigation_range: [239; 240), 361 navigation_range: [239; 240),
362 node_range: [234; 243), 362 node_range: [234; 243),
363 kind: IMPL_BLOCK, 363 kind: IMPL_DEF,
364 detail: None, 364 detail: None,
365 deprecated: false, 365 deprecated: false,
366 }, 366 },
@@ -369,7 +369,7 @@ fn very_obsolete() {}
369 label: "impl fmt::Debug for E", 369 label: "impl fmt::Debug for E",
370 navigation_range: [265; 266), 370 navigation_range: [265; 266),
371 node_range: [245; 269), 371 node_range: [245; 269),
372 kind: IMPL_BLOCK, 372 kind: IMPL_DEF,
373 detail: None, 373 detail: None,
374 deprecated: false, 374 deprecated: false,
375 }, 375 },
diff --git a/crates/ra_ide/src/expand_macro.rs b/crates/ra_ide/src/expand_macro.rs
index 5a079de27..f6667cb33 100644
--- a/crates/ra_ide/src/expand_macro.rs
+++ b/crates/ra_ide/src/expand_macro.rs
@@ -195,7 +195,7 @@ fn some_thing() -> u32 {
195 mat<|>ch_ast! { 195 mat<|>ch_ast! {
196 match container { 196 match container {
197 ast::TraitDef(it) => {}, 197 ast::TraitDef(it) => {},
198 ast::ImplBlock(it) => {}, 198 ast::ImplDef(it) => {},
199 _ => { continue }, 199 _ => { continue },
200 } 200 }
201 } 201 }
@@ -207,7 +207,7 @@ fn some_thing() -> u32 {
207 assert_snapshot!(res.expansion, @r###" 207 assert_snapshot!(res.expansion, @r###"
208{ 208{
209 if let Some(it) = ast::TraitDef::cast(container.clone()){} 209 if let Some(it) = ast::TraitDef::cast(container.clone()){}
210 else if let Some(it) = ast::ImplBlock::cast(container.clone()){} 210 else if let Some(it) = ast::ImplDef::cast(container.clone()){}
211 else { 211 else {
212 { 212 {
213 continue 213 continue
diff --git a/crates/ra_ide/src/goto_definition.rs b/crates/ra_ide/src/goto_definition.rs
index 621ab982c..e67585203 100644
--- a/crates/ra_ide/src/goto_definition.rs
+++ b/crates/ra_ide/src/goto_definition.rs
@@ -477,7 +477,7 @@ mod tests {
477 } 477 }
478 } 478 }
479 ", 479 ",
480 "impl IMPL_BLOCK FileId(1) [12; 73)", 480 "impl IMPL_DEF FileId(1) [12; 73)",
481 "impl Foo {...}", 481 "impl Foo {...}",
482 ); 482 );
483 483
@@ -491,7 +491,7 @@ mod tests {
491 } 491 }
492 } 492 }
493 ", 493 ",
494 "impl IMPL_BLOCK FileId(1) [12; 73)", 494 "impl IMPL_DEF FileId(1) [12; 73)",
495 "impl Foo {...}", 495 "impl Foo {...}",
496 ); 496 );
497 497
@@ -505,7 +505,7 @@ mod tests {
505 } 505 }
506 } 506 }
507 ", 507 ",
508 "impl IMPL_BLOCK FileId(1) [15; 75)", 508 "impl IMPL_DEF FileId(1) [15; 75)",
509 "impl Foo {...}", 509 "impl Foo {...}",
510 ); 510 );
511 511
@@ -518,7 +518,7 @@ mod tests {
518 } 518 }
519 } 519 }
520 ", 520 ",
521 "impl IMPL_BLOCK FileId(1) [15; 62)", 521 "impl IMPL_DEF FileId(1) [15; 62)",
522 "impl Foo {...}", 522 "impl Foo {...}",
523 ); 523 );
524 } 524 }
@@ -538,7 +538,7 @@ mod tests {
538 } 538 }
539 } 539 }
540 ", 540 ",
541 "impl IMPL_BLOCK FileId(1) [49; 115)", 541 "impl IMPL_DEF FileId(1) [49; 115)",
542 "impl Make for Foo {...}", 542 "impl Make for Foo {...}",
543 ); 543 );
544 544
@@ -555,7 +555,7 @@ mod tests {
555 } 555 }
556 } 556 }
557 ", 557 ",
558 "impl IMPL_BLOCK FileId(1) [49; 115)", 558 "impl IMPL_DEF FileId(1) [49; 115)",
559 "impl Make for Foo {...}", 559 "impl Make for Foo {...}",
560 ); 560 );
561 } 561 }
diff --git a/crates/ra_ide/src/impls.rs b/crates/ra_ide/src/impls.rs
index bf82b2a16..68529c8a5 100644
--- a/crates/ra_ide/src/impls.rs
+++ b/crates/ra_ide/src/impls.rs
@@ -1,6 +1,6 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir::{Crate, ImplBlock, Semantics}; 3use hir::{Crate, ImplDef, Semantics};
4use ra_ide_db::RootDatabase; 4use ra_ide_db::RootDatabase;
5use ra_syntax::{algo::find_node_at_offset, ast, AstNode}; 5use ra_syntax::{algo::find_node_at_offset, ast, AstNode};
6 6
@@ -42,12 +42,12 @@ fn impls_for_def(
42 ast::NominalDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db), 42 ast::NominalDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db),
43 }; 43 };
44 44
45 let impls = ImplBlock::all_in_crate(sema.db, krate); 45 let impls = ImplDef::all_in_crate(sema.db, krate);
46 46
47 Some( 47 Some(
48 impls 48 impls
49 .into_iter() 49 .into_iter()
50 .filter(|impl_block| ty.is_equal_for_find_impls(&impl_block.target_ty(sema.db))) 50 .filter(|impl_def| ty.is_equal_for_find_impls(&impl_def.target_ty(sema.db)))
51 .map(|imp| imp.to_nav(sema.db)) 51 .map(|imp| imp.to_nav(sema.db))
52 .collect(), 52 .collect(),
53 ) 53 )
@@ -60,7 +60,7 @@ fn impls_for_trait(
60) -> Option<Vec<NavigationTarget>> { 60) -> Option<Vec<NavigationTarget>> {
61 let tr = sema.to_def(node)?; 61 let tr = sema.to_def(node)?;
62 62
63 let impls = ImplBlock::for_trait(sema.db, krate, tr); 63 let impls = ImplDef::for_trait(sema.db, krate, tr);
64 64
65 Some(impls.into_iter().map(|imp| imp.to_nav(sema.db)).collect()) 65 Some(impls.into_iter().map(|imp| imp.to_nav(sema.db)).collect())
66} 66}
@@ -86,7 +86,7 @@ mod tests {
86 struct Foo<|>; 86 struct Foo<|>;
87 impl Foo {} 87 impl Foo {}
88 ", 88 ",
89 &["impl IMPL_BLOCK FileId(1) [12; 23)"], 89 &["impl IMPL_DEF FileId(1) [12; 23)"],
90 ); 90 );
91 } 91 }
92 92
@@ -99,7 +99,7 @@ mod tests {
99 impl Foo {} 99 impl Foo {}
100 impl Foo {} 100 impl Foo {}
101 ", 101 ",
102 &["impl IMPL_BLOCK FileId(1) [12; 23)", "impl IMPL_BLOCK FileId(1) [24; 35)"], 102 &["impl IMPL_DEF FileId(1) [12; 23)", "impl IMPL_DEF FileId(1) [24; 35)"],
103 ); 103 );
104 } 104 }
105 105
@@ -116,7 +116,7 @@ mod tests {
116 impl super::Foo {} 116 impl super::Foo {}
117 } 117 }
118 ", 118 ",
119 &["impl IMPL_BLOCK FileId(1) [24; 42)", "impl IMPL_BLOCK FileId(1) [57; 75)"], 119 &["impl IMPL_DEF FileId(1) [24; 42)", "impl IMPL_DEF FileId(1) [57; 75)"],
120 ); 120 );
121 } 121 }
122 122
@@ -133,7 +133,7 @@ mod tests {
133 //- /b.rs 133 //- /b.rs
134 impl crate::Foo {} 134 impl crate::Foo {}
135 ", 135 ",
136 &["impl IMPL_BLOCK FileId(2) [0; 18)", "impl IMPL_BLOCK FileId(3) [0; 18)"], 136 &["impl IMPL_DEF FileId(2) [0; 18)", "impl IMPL_DEF FileId(3) [0; 18)"],
137 ); 137 );
138 } 138 }
139 139
@@ -146,7 +146,7 @@ mod tests {
146 struct Foo; 146 struct Foo;
147 impl T for Foo {} 147 impl T for Foo {}
148 ", 148 ",
149 &["impl IMPL_BLOCK FileId(1) [23; 40)"], 149 &["impl IMPL_DEF FileId(1) [23; 40)"],
150 ); 150 );
151 } 151 }
152 152
@@ -164,7 +164,7 @@ mod tests {
164 //- /b.rs 164 //- /b.rs
165 impl crate::T for crate::Foo {} 165 impl crate::T for crate::Foo {}
166 ", 166 ",
167 &["impl IMPL_BLOCK FileId(2) [0; 31)", "impl IMPL_BLOCK FileId(3) [0; 31)"], 167 &["impl IMPL_DEF FileId(2) [0; 31)", "impl IMPL_DEF FileId(3) [0; 31)"],
168 ); 168 );
169 } 169 }
170 170
@@ -180,9 +180,9 @@ mod tests {
180 impl T for &Foo {} 180 impl T for &Foo {}
181 ", 181 ",
182 &[ 182 &[
183 "impl IMPL_BLOCK FileId(1) [23; 34)", 183 "impl IMPL_DEF FileId(1) [23; 34)",
184 "impl IMPL_BLOCK FileId(1) [35; 52)", 184 "impl IMPL_DEF FileId(1) [35; 52)",
185 "impl IMPL_BLOCK FileId(1) [53; 71)", 185 "impl IMPL_DEF FileId(1) [53; 71)",
186 ], 186 ],
187 ); 187 );
188 } 188 }
@@ -195,7 +195,7 @@ mod tests {
195 #[derive(Copy)] 195 #[derive(Copy)]
196 struct Foo<|>; 196 struct Foo<|>;
197 ", 197 ",
198 &["impl IMPL_BLOCK FileId(1) [0; 15)"], 198 &["impl IMPL_DEF FileId(1) [0; 15)"],
199 ); 199 );
200 } 200 }
201} 201}
diff --git a/crates/ra_ide/src/references/classify.rs b/crates/ra_ide/src/references/classify.rs
index 91b21429a..fdd07d8d1 100644
--- a/crates/ra_ide/src/references/classify.rs
+++ b/crates/ra_ide/src/references/classify.rs
@@ -61,7 +61,7 @@ pub(crate) fn classify_name_ref(
61 PathResolution::Local(local) => NameDefinition::Local(local), 61 PathResolution::Local(local) => NameDefinition::Local(local),
62 PathResolution::TypeParam(par) => NameDefinition::TypeParam(par), 62 PathResolution::TypeParam(par) => NameDefinition::TypeParam(par),
63 PathResolution::Macro(def) => NameDefinition::Macro(def), 63 PathResolution::Macro(def) => NameDefinition::Macro(def),
64 PathResolution::SelfType(impl_block) => NameDefinition::SelfType(impl_block), 64 PathResolution::SelfType(impl_def) => NameDefinition::SelfType(impl_def),
65 }; 65 };
66 Some(res) 66 Some(res)
67} 67}
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 93f32ba85..ad4638906 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -6,7 +6,7 @@
6// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06). 6// FIXME: this badly needs rename/rewrite (matklad, 2020-02-06).
7 7
8use hir::{ 8use hir::{
9 Adt, FieldSource, HasSource, ImplBlock, Local, MacroDef, Module, ModuleDef, Semantics, 9 Adt, FieldSource, HasSource, ImplDef, Local, MacroDef, Module, ModuleDef, Semantics,
10 StructField, TypeParam, 10 StructField, TypeParam,
11}; 11};
12use ra_prof::profile; 12use ra_prof::profile;
@@ -22,7 +22,7 @@ pub enum NameDefinition {
22 Macro(MacroDef), 22 Macro(MacroDef),
23 StructField(StructField), 23 StructField(StructField),
24 ModuleDef(ModuleDef), 24 ModuleDef(ModuleDef),
25 SelfType(ImplBlock), 25 SelfType(ImplDef),
26 Local(Local), 26 Local(Local),
27 TypeParam(TypeParam), 27 TypeParam(TypeParam),
28} 28}
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index a46e11e1d..58098e810 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -152,7 +152,7 @@ pub(crate) fn reparser(
152 EXTERN_ITEM_LIST => items::extern_item_list, 152 EXTERN_ITEM_LIST => items::extern_item_list,
153 TOKEN_TREE if first_child? == T!['{'] => items::token_tree, 153 TOKEN_TREE if first_child? == T!['{'] => items::token_tree,
154 ITEM_LIST => match parent? { 154 ITEM_LIST => match parent? {
155 IMPL_BLOCK => items::impl_item_list, 155 IMPL_DEF => items::impl_item_list,
156 TRAIT_DEF => items::trait_item_list, 156 TRAIT_DEF => items::trait_item_list,
157 MODULE => items::mod_item_list, 157 MODULE => items::mod_item_list,
158 _ => return None, 158 _ => return None,
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index f8b43866c..433ed6812 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -202,8 +202,8 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
202 // test unsafe_default_impl 202 // test unsafe_default_impl
203 // unsafe default impl Foo {} 203 // unsafe default impl Foo {}
204 T![impl] => { 204 T![impl] => {
205 traits::impl_block(p); 205 traits::impl_def(p);
206 m.complete(p, IMPL_BLOCK); 206 m.complete(p, IMPL_DEF);
207 } 207 }
208 208
209 // test existential_type 209 // test existential_type
diff --git a/crates/ra_parser/src/grammar/items/traits.rs b/crates/ra_parser/src/grammar/items/traits.rs
index 03dae3cdb..c819e33be 100644
--- a/crates/ra_parser/src/grammar/items/traits.rs
+++ b/crates/ra_parser/src/grammar/items/traits.rs
@@ -53,9 +53,9 @@ pub(crate) fn trait_item_list(p: &mut Parser) {
53 m.complete(p, ITEM_LIST); 53 m.complete(p, ITEM_LIST);
54} 54}
55 55
56// test impl_block 56// test impl_def
57// impl Foo {} 57// impl Foo {}
58pub(super) fn impl_block(p: &mut Parser) { 58pub(super) fn impl_def(p: &mut Parser) {
59 assert!(p.at(T![impl])); 59 assert!(p.at(T![impl]));
60 p.bump(T![impl]); 60 p.bump(T![impl]);
61 if choose_type_params_over_qpath(p) { 61 if choose_type_params_over_qpath(p) {
@@ -65,7 +65,7 @@ pub(super) fn impl_block(p: &mut Parser) {
65 // FIXME: never type 65 // FIXME: never type
66 // impl ! {} 66 // impl ! {}
67 67
68 // test impl_block_neg 68 // test impl_def_neg
69 // impl !Send for X {} 69 // impl !Send for X {}
70 p.eat(T![!]); 70 p.eat(T![!]);
71 impl_type(p); 71 impl_type(p);
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 1068da0a0..dfc30d727 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -133,7 +133,7 @@ pub enum SyntaxKind {
133 STATIC_DEF, 133 STATIC_DEF,
134 CONST_DEF, 134 CONST_DEF,
135 TRAIT_DEF, 135 TRAIT_DEF,
136 IMPL_BLOCK, 136 IMPL_DEF,
137 TYPE_ALIAS_DEF, 137 TYPE_ALIAS_DEF,
138 MACRO_CALL, 138 MACRO_CALL,
139 TOKEN_TREE, 139 TOKEN_TREE,
diff --git a/crates/ra_syntax/src/ast/extensions.rs b/crates/ra_syntax/src/ast/extensions.rs
index 44de4af89..d5986e8b4 100644
--- a/crates/ra_syntax/src/ast/extensions.rs
+++ b/crates/ra_syntax/src/ast/extensions.rs
@@ -169,7 +169,7 @@ impl ast::UseTreeList {
169 } 169 }
170} 170}
171 171
172impl ast::ImplBlock { 172impl ast::ImplDef {
173 pub fn target_type(&self) -> Option<ast::TypeRef> { 173 pub fn target_type(&self) -> Option<ast::TypeRef> {
174 match self.target() { 174 match self.target() {
175 (Some(t), None) | (_, Some(t)) => Some(t), 175 (Some(t), None) | (_, Some(t)) => Some(t),
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 8eb240801..150893e39 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -552,13 +552,13 @@ impl TypeAliasDef {
552 } 552 }
553} 553}
554#[derive(Debug, Clone, PartialEq, Eq, Hash)] 554#[derive(Debug, Clone, PartialEq, Eq, Hash)]
555pub struct ImplBlock { 555pub struct ImplDef {
556 pub(crate) syntax: SyntaxNode, 556 pub(crate) syntax: SyntaxNode,
557} 557}
558impl AstNode for ImplBlock { 558impl AstNode for ImplDef {
559 fn can_cast(kind: SyntaxKind) -> bool { 559 fn can_cast(kind: SyntaxKind) -> bool {
560 match kind { 560 match kind {
561 IMPL_BLOCK => true, 561 IMPL_DEF => true,
562 _ => false, 562 _ => false,
563 } 563 }
564 } 564 }
@@ -573,9 +573,9 @@ impl AstNode for ImplBlock {
573 &self.syntax 573 &self.syntax
574 } 574 }
575} 575}
576impl ast::TypeParamsOwner for ImplBlock {} 576impl ast::TypeParamsOwner for ImplDef {}
577impl ast::AttrsOwner for ImplBlock {} 577impl ast::AttrsOwner for ImplDef {}
578impl ImplBlock { 578impl ImplDef {
579 pub fn item_list(&self) -> Option<ItemList> { 579 pub fn item_list(&self) -> Option<ItemList> {
580 AstChildren::new(&self.syntax).next() 580 AstChildren::new(&self.syntax).next()
581 } 581 }
@@ -3524,7 +3524,7 @@ pub enum ModuleItem {
3524 FnDef(FnDef), 3524 FnDef(FnDef),
3525 TraitDef(TraitDef), 3525 TraitDef(TraitDef),
3526 TypeAliasDef(TypeAliasDef), 3526 TypeAliasDef(TypeAliasDef),
3527 ImplBlock(ImplBlock), 3527 ImplDef(ImplDef),
3528 UseItem(UseItem), 3528 UseItem(UseItem),
3529 ExternCrateItem(ExternCrateItem), 3529 ExternCrateItem(ExternCrateItem),
3530 ConstDef(ConstDef), 3530 ConstDef(ConstDef),
@@ -3561,9 +3561,9 @@ impl From<TypeAliasDef> for ModuleItem {
3561 ModuleItem::TypeAliasDef(node) 3561 ModuleItem::TypeAliasDef(node)
3562 } 3562 }
3563} 3563}
3564impl From<ImplBlock> for ModuleItem { 3564impl From<ImplDef> for ModuleItem {
3565 fn from(node: ImplBlock) -> ModuleItem { 3565 fn from(node: ImplDef) -> ModuleItem {
3566 ModuleItem::ImplBlock(node) 3566 ModuleItem::ImplDef(node)
3567 } 3567 }
3568} 3568}
3569impl From<UseItem> for ModuleItem { 3569impl From<UseItem> for ModuleItem {
@@ -3594,8 +3594,8 @@ impl From<Module> for ModuleItem {
3594impl AstNode for ModuleItem { 3594impl AstNode for ModuleItem {
3595 fn can_cast(kind: SyntaxKind) -> bool { 3595 fn can_cast(kind: SyntaxKind) -> bool {
3596 match kind { 3596 match kind {
3597 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF 3597 STRUCT_DEF | UNION_DEF | ENUM_DEF | FN_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | IMPL_DEF
3598 | IMPL_BLOCK | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true, 3598 | USE_ITEM | EXTERN_CRATE_ITEM | CONST_DEF | STATIC_DEF | MODULE => true,
3599 _ => false, 3599 _ => false,
3600 } 3600 }
3601 } 3601 }
@@ -3607,7 +3607,7 @@ impl AstNode for ModuleItem {
3607 FN_DEF => ModuleItem::FnDef(FnDef { syntax }), 3607 FN_DEF => ModuleItem::FnDef(FnDef { syntax }),
3608 TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }), 3608 TRAIT_DEF => ModuleItem::TraitDef(TraitDef { syntax }),
3609 TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }), 3609 TYPE_ALIAS_DEF => ModuleItem::TypeAliasDef(TypeAliasDef { syntax }),
3610 IMPL_BLOCK => ModuleItem::ImplBlock(ImplBlock { syntax }), 3610 IMPL_DEF => ModuleItem::ImplDef(ImplDef { syntax }),
3611 USE_ITEM => ModuleItem::UseItem(UseItem { syntax }), 3611 USE_ITEM => ModuleItem::UseItem(UseItem { syntax }),
3612 EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }), 3612 EXTERN_CRATE_ITEM => ModuleItem::ExternCrateItem(ExternCrateItem { syntax }),
3613 CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }), 3613 CONST_DEF => ModuleItem::ConstDef(ConstDef { syntax }),
@@ -3625,7 +3625,7 @@ impl AstNode for ModuleItem {
3625 ModuleItem::FnDef(it) => &it.syntax, 3625 ModuleItem::FnDef(it) => &it.syntax,
3626 ModuleItem::TraitDef(it) => &it.syntax, 3626 ModuleItem::TraitDef(it) => &it.syntax,
3627 ModuleItem::TypeAliasDef(it) => &it.syntax, 3627 ModuleItem::TypeAliasDef(it) => &it.syntax,
3628 ModuleItem::ImplBlock(it) => &it.syntax, 3628 ModuleItem::ImplDef(it) => &it.syntax,
3629 ModuleItem::UseItem(it) => &it.syntax, 3629 ModuleItem::UseItem(it) => &it.syntax,
3630 ModuleItem::ExternCrateItem(it) => &it.syntax, 3630 ModuleItem::ExternCrateItem(it) => &it.syntax,
3631 ModuleItem::ConstDef(it) => &it.syntax, 3631 ModuleItem::ConstDef(it) => &it.syntax,
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index 863859dca..7915cf8cb 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -203,12 +203,11 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
203 _ => return, 203 _ => return,
204 } 204 }
205 205
206 let impl_block = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplBlock::cast) 206 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplDef::cast) {
207 {
208 Some(it) => it, 207 Some(it) => it,
209 None => return, 208 None => return,
210 }; 209 };
211 if impl_block.target_trait().is_some() { 210 if impl_def.target_trait().is_some() {
212 errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range())); 211 errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range()));
213 } 212 }
214} 213}
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt
index b9e60f6c1..4b13a7236 100644
--- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt
+++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 183) 1SOURCE_FILE@[0; 183)
2 IMPL_BLOCK@[0; 182) 2 IMPL_DEF@[0; 182)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 13) 5 PATH_TYPE@[5; 13)
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
index bb87022b0..9f50c85e5 100644
--- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
+++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.txt
@@ -77,7 +77,7 @@ SOURCE_FILE@[0; 112)
77 ERROR@[54; 55) 77 ERROR@[54; 55)
78 COMMA@[54; 55) "," 78 COMMA@[54; 55) ","
79 WHITESPACE@[55; 56) " " 79 WHITESPACE@[55; 56) " "
80 IMPL_BLOCK@[56; 60) 80 IMPL_DEF@[56; 60)
81 IMPL_KW@[56; 60) "impl" 81 IMPL_KW@[56; 60) "impl"
82 EXPR_STMT@[60; 61) 82 EXPR_STMT@[60; 61)
83 ERROR@[60; 61) 83 ERROR@[60; 61)
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt
index 3942e0904..f239b7b1e 100644
--- a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt
+++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 38) 1SOURCE_FILE@[0; 38)
2 IMPL_BLOCK@[0; 14) 2 IMPL_DEF@[0; 14)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 TYPE_PARAM_LIST@[4; 14) 4 TYPE_PARAM_LIST@[4; 14)
5 L_ANGLE@[4; 5) "<" 5 L_ANGLE@[4; 5) "<"
@@ -17,7 +17,7 @@ SOURCE_FILE@[0; 38)
17 IDENT@[8; 13) "Clone" 17 IDENT@[8; 13) "Clone"
18 R_ANGLE@[13; 14) ">" 18 R_ANGLE@[13; 14) ">"
19 WHITESPACE@[14; 15) "\n" 19 WHITESPACE@[14; 15) "\n"
20 IMPL_BLOCK@[15; 37) 20 IMPL_DEF@[15; 37)
21 IMPL_KW@[15; 19) "impl" 21 IMPL_KW@[15; 19) "impl"
22 TYPE_PARAM_LIST@[19; 22) 22 TYPE_PARAM_LIST@[19; 22)
23 L_ANGLE@[19; 20) "<" 23 L_ANGLE@[19; 20) "<"
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt
index d0a128a5f..d8622d45f 100644
--- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt
+++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 118) 1SOURCE_FILE@[0; 118)
2 IMPL_BLOCK@[0; 117) 2 IMPL_DEF@[0; 117)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt
index 0187d872d..01a853d63 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt
+++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.txt
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 30)
18 LIFETIME@[16; 21) "\'loop" 18 LIFETIME@[16; 21) "\'loop"
19 COLON@[21; 22) ":" 19 COLON@[21; 22) ":"
20 WHITESPACE@[22; 23) " " 20 WHITESPACE@[22; 23) " "
21 IMPL_BLOCK@[23; 27) 21 IMPL_DEF@[23; 27)
22 IMPL_KW@[23; 27) "impl" 22 IMPL_KW@[23; 27) "impl"
23 WHITESPACE@[27; 28) "\n" 23 WHITESPACE@[27; 28) "\n"
24 R_CURLY@[28; 29) "}" 24 R_CURLY@[28; 29) "}"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt
index d5aea05c2..124f0a891 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt
+++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 87) 1SOURCE_FILE@[0; 87)
2 IMPL_BLOCK@[0; 12) 2 IMPL_DEF@[0; 12)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 9) 5 PATH_TYPE@[5; 9)
@@ -12,7 +12,7 @@ SOURCE_FILE@[0; 87)
12 L_CURLY@[10; 11) "{" 12 L_CURLY@[10; 11) "{"
13 R_CURLY@[11; 12) "}" 13 R_CURLY@[11; 12) "}"
14 WHITESPACE@[12; 13) "\n" 14 WHITESPACE@[12; 13) "\n"
15 IMPL_BLOCK@[13; 33) 15 IMPL_DEF@[13; 33)
16 IMPL_KW@[13; 17) "impl" 16 IMPL_KW@[13; 17) "impl"
17 WHITESPACE@[17; 18) " " 17 WHITESPACE@[17; 18) " "
18 PATH_TYPE@[18; 24) 18 PATH_TYPE@[18; 24)
@@ -33,10 +33,10 @@ SOURCE_FILE@[0; 87)
33 L_CURLY@[31; 32) "{" 33 L_CURLY@[31; 32) "{"
34 R_CURLY@[32; 33) "}" 34 R_CURLY@[32; 33) "}"
35 WHITESPACE@[33; 34) "\n" 35 WHITESPACE@[33; 34) "\n"
36 IMPL_BLOCK@[34; 38) 36 IMPL_DEF@[34; 38)
37 IMPL_KW@[34; 38) "impl" 37 IMPL_KW@[34; 38) "impl"
38 WHITESPACE@[38; 39) " " 38 WHITESPACE@[38; 39) " "
39 IMPL_BLOCK@[39; 54) 39 IMPL_DEF@[39; 54)
40 IMPL_KW@[39; 43) "impl" 40 IMPL_KW@[39; 43) "impl"
41 WHITESPACE@[43; 44) " " 41 WHITESPACE@[43; 44) " "
42 PATH_TYPE@[44; 51) 42 PATH_TYPE@[44; 51)
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 87)
49 L_CURLY@[52; 53) "{" 49 L_CURLY@[52; 53) "{"
50 R_CURLY@[53; 54) "}" 50 R_CURLY@[53; 54) "}"
51 WHITESPACE@[54; 55) "\n" 51 WHITESPACE@[54; 55) "\n"
52 IMPL_BLOCK@[55; 70) 52 IMPL_DEF@[55; 70)
53 IMPL_KW@[55; 59) "impl" 53 IMPL_KW@[55; 59) "impl"
54 WHITESPACE@[59; 60) " " 54 WHITESPACE@[59; 60) " "
55 PATH_TYPE@[60; 66) 55 PATH_TYPE@[60; 66)
@@ -60,7 +60,7 @@ SOURCE_FILE@[0; 87)
60 WHITESPACE@[66; 67) " " 60 WHITESPACE@[66; 67) " "
61 FOR_KW@[67; 70) "for" 61 FOR_KW@[67; 70) "for"
62 WHITESPACE@[70; 71) " " 62 WHITESPACE@[70; 71) " "
63 IMPL_BLOCK@[71; 86) 63 IMPL_DEF@[71; 86)
64 IMPL_KW@[71; 75) "impl" 64 IMPL_KW@[71; 75) "impl"
65 WHITESPACE@[75; 76) " " 65 WHITESPACE@[75; 76) " "
66 PATH_TYPE@[76; 83) 66 PATH_TYPE@[76; 83)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt
index d4e710dd4..ad9f0965e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 83) 1SOURCE_FILE@[0; 83)
2 IMPL_BLOCK@[0; 82) 2 IMPL_DEF@[0; 82)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt
index 0ccd12b0a..757ac092a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 128) 1SOURCE_FILE@[0; 128)
2 IMPL_BLOCK@[0; 127) 2 IMPL_DEF@[0; 127)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt
index d0beeb81e..89caee543 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 69) 1SOURCE_FILE@[0; 69)
2 IMPL_BLOCK@[0; 68) 2 IMPL_DEF@[0; 68)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt
index 0768f0518..b1af67976 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 89) 1SOURCE_FILE@[0; 89)
2 IMPL_BLOCK@[0; 88) 2 IMPL_DEF@[0; 88)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt
index 8f3dcaf88..0a768a8e3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 27) 1SOURCE_FILE@[0; 27)
2 IMPL_BLOCK@[0; 26) 2 IMPL_DEF@[0; 26)
3 UNSAFE_KW@[0; 6) "unsafe" 3 UNSAFE_KW@[0; 6) "unsafe"
4 WHITESPACE@[6; 7) " " 4 WHITESPACE@[6; 7) " "
5 DEFAULT_KW@[7; 14) "default" 5 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_def_neg.rs
index b7527c870..b7527c870 100644
--- 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_def_neg.rs
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_def_neg.txt
index dfff947fe..0cc3ac085 100644
--- 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_def_neg.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 20) 1SOURCE_FILE@[0; 20)
2 IMPL_BLOCK@[0; 19) 2 IMPL_DEF@[0; 19)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 EXCL@[5; 6) "!" 5 EXCL@[5; 6) "!"
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_def.rs
index d6337f6b3..d6337f6b3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.rs
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rs
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_def.txt
index bda3435e8..4c2863ba7 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_block.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 12) 1SOURCE_FILE@[0; 12)
2 IMPL_BLOCK@[0; 11) 2 IMPL_DEF@[0; 11)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 8) 5 PATH_TYPE@[5; 8)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt
index 590e2a88f..e614acc6f 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 19) 1SOURCE_FILE@[0; 19)
2 IMPL_BLOCK@[0; 18) 2 IMPL_DEF@[0; 18)
3 UNSAFE_KW@[0; 6) "unsafe" 3 UNSAFE_KW@[0; 6) "unsafe"
4 WHITESPACE@[6; 7) " " 4 WHITESPACE@[6; 7) " "
5 IMPL_KW@[7; 11) "impl" 5 IMPL_KW@[7; 11) "impl"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt
index ada94a824..af9077270 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 20) 1SOURCE_FILE@[0; 20)
2 IMPL_BLOCK@[0; 19) 2 IMPL_DEF@[0; 19)
3 DEFAULT_KW@[0; 7) "default" 3 DEFAULT_KW@[0; 7) "default"
4 WHITESPACE@[7; 8) " " 4 WHITESPACE@[7; 8) " "
5 IMPL_KW@[8; 12) "impl" 5 IMPL_KW@[8; 12) "impl"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt
index 0e9e9b95b..5053ebde7 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.txt
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 94)
8 L_CURLY@[6; 7) "{" 8 L_CURLY@[6; 7) "{"
9 R_CURLY@[7; 8) "}" 9 R_CURLY@[7; 8) "}"
10 WHITESPACE@[8; 9) "\n" 10 WHITESPACE@[8; 9) "\n"
11 IMPL_BLOCK@[9; 93) 11 IMPL_DEF@[9; 93)
12 IMPL_KW@[9; 13) "impl" 12 IMPL_KW@[9; 13) "impl"
13 WHITESPACE@[13; 14) " " 13 WHITESPACE@[13; 14) " "
14 PATH_TYPE@[14; 15) 14 PATH_TYPE@[14; 15)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt
index 022070b0c..e1734224b 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 69) 1SOURCE_FILE@[0; 69)
2 IMPL_BLOCK@[0; 68) 2 IMPL_DEF@[0; 68)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt
index 47fadef85..2d46eebb3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 29) 1SOURCE_FILE@[0; 29)
2 IMPL_BLOCK@[0; 28) 2 IMPL_DEF@[0; 28)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 TYPE_PARAM_LIST@[4; 18) 4 TYPE_PARAM_LIST@[4; 18)
5 L_ANGLE@[4; 5) "<" 5 L_ANGLE@[4; 5) "<"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt b/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt
index 933f5b7bd..b30030de3 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_fn_patterns.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 137) 1SOURCE_FILE@[0; 137)
2 IMPL_BLOCK@[0; 136) 2 IMPL_DEF@[0; 136)
3 IMPL_KW@[0; 4) "impl" 3 IMPL_KW@[0; 4) "impl"
4 WHITESPACE@[4; 5) " " 4 WHITESPACE@[4; 5) " "
5 PATH_TYPE@[5; 6) 5 PATH_TYPE@[5; 6)
diff --git a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt
index 72f053dfc..341e02704 100644
--- a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.txt
@@ -8,7 +8,7 @@ SOURCE_FILE@[0; 199)
8 IDENT@[69; 72) "Foo" 8 IDENT@[69; 72) "Foo"
9 SEMI@[72; 73) ";" 9 SEMI@[72; 73) ";"
10 WHITESPACE@[73; 75) "\n\n" 10 WHITESPACE@[73; 75) "\n\n"
11 IMPL_BLOCK@[75; 141) 11 IMPL_DEF@[75; 141)
12 IMPL_KW@[75; 79) "impl" 12 IMPL_KW@[75; 79) "impl"
13 WHITESPACE@[79; 80) " " 13 WHITESPACE@[79; 80) " "
14 PATH_TYPE@[80; 83) 14 PATH_TYPE@[80; 83)
diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt
index 3d9aab500..e15447ca7 100644
--- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.txt
@@ -92,7 +92,7 @@ SOURCE_FILE@[0; 686)
92 WHITESPACE@[461; 463) "\n\n" 92 WHITESPACE@[461; 463) "\n\n"
93 COMMENT@[463; 523) "// https://github.com ..." 93 COMMENT@[463; 523) "// https://github.com ..."
94 WHITESPACE@[523; 524) "\n" 94 WHITESPACE@[523; 524) "\n"
95 IMPL_BLOCK@[524; 685) 95 IMPL_DEF@[524; 685)
96 IMPL_KW@[524; 528) "impl" 96 IMPL_KW@[524; 528) "impl"
97 WHITESPACE@[528; 529) " " 97 WHITESPACE@[528; 529) " "
98 PATH_TYPE@[529; 537) 98 PATH_TYPE@[529; 537)
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
index bfd47d2e1..719c99c17 100644
--- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
+++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.txt
@@ -253,7 +253,7 @@ SOURCE_FILE@[0; 519)
253 WHITESPACE@[234; 235) "\n" 253 WHITESPACE@[234; 235) "\n"
254 R_CURLY@[235; 236) "}" 254 R_CURLY@[235; 236) "}"
255 WHITESPACE@[236; 238) "\n\n" 255 WHITESPACE@[236; 238) "\n\n"
256 IMPL_BLOCK@[238; 519) 256 IMPL_DEF@[238; 519)
257 IMPL_KW@[238; 242) "impl" 257 IMPL_KW@[238; 242) "impl"
258 WHITESPACE@[242; 243) " " 258 WHITESPACE@[242; 243) " "
259 PATH_TYPE@[243; 244) 259 PATH_TYPE@[243; 244)
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index d70d34bdc..6bf0be565 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -76,8 +76,8 @@ pub fn analysis_stats(
76 } 76 }
77 } 77 }
78 78
79 for impl_block in module.impl_blocks(db) { 79 for impl_def in module.impl_defs(db) {
80 for item in impl_block.items(db) { 80 for item in impl_def.items(db) {
81 num_decls += 1; 81 num_decls += 1;
82 if let AssocItem::Function(f) = item { 82 if let AssocItem::Function(f) = item {
83 funcs.push(f); 83 funcs.push(f);
diff --git a/crates/rust-analyzer/src/conv.rs b/crates/rust-analyzer/src/conv.rs
index ff156307a..eeeb33e8f 100644
--- a/crates/rust-analyzer/src/conv.rs
+++ b/crates/rust-analyzer/src/conv.rs
@@ -57,7 +57,7 @@ impl Conv for SyntaxKind {
57 SyntaxKind::RECORD_FIELD_DEF => SymbolKind::Field, 57 SyntaxKind::RECORD_FIELD_DEF => SymbolKind::Field,
58 SyntaxKind::STATIC_DEF => SymbolKind::Constant, 58 SyntaxKind::STATIC_DEF => SymbolKind::Constant,
59 SyntaxKind::CONST_DEF => SymbolKind::Constant, 59 SyntaxKind::CONST_DEF => SymbolKind::Constant,
60 SyntaxKind::IMPL_BLOCK => SymbolKind::Object, 60 SyntaxKind::IMPL_DEF => SymbolKind::Object,
61 _ => SymbolKind::Variable, 61 _ => SymbolKind::Variable,
62 } 62 }
63 } 63 }