aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/ast_transform.rs4
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs2
-rw-r--r--crates/ra_assists/src/handlers/change_visibility.rs4
-rw-r--r--crates/ra_assists/src/handlers/generate_new.rs6
-rw-r--r--crates/ra_assists/src/handlers/introduce_named_lifetime.rs4
-rw-r--r--crates/ra_assists/src/handlers/move_bounds.rs4
-rw-r--r--crates/ra_assists/src/utils.rs4
-rw-r--r--crates/ra_hir/src/has_source.rs10
-rw-r--r--crates/ra_hir/src/semantics.rs4
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs12
-rw-r--r--crates/ra_hir_def/src/body/lower.rs4
-rw-r--r--crates/ra_hir_def/src/generics.rs4
-rw-r--r--crates/ra_hir_def/src/item_tree.rs8
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs12
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs10
-rw-r--r--crates/ra_hir_def/src/keys.rs4
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs8
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs4
-rw-r--r--crates/ra_ide/src/completion/patterns.rs8
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs4
-rw-r--r--crates/ra_ide/src/display/short_label.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs8
-rw-r--r--crates/ra_ide/src/goto_implementation.rs4
-rw-r--r--crates/ra_ide/src/hover.rs32
-rw-r--r--crates/ra_ide/src/references/rename.rs5
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs4
-rw-r--r--crates/ra_ide_db/src/defs.rs2
-rw-r--r--crates/ra_ide_db/src/symbol_index.rs4
-rw-r--r--crates/ra_parser/src/grammar.rs4
-rw-r--r--crates/ra_parser/src/grammar/items.rs4
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs63
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs6
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs2
-rw-r--r--crates/ra_syntax/src/validation.rs2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0043_default_const.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast12
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0030_traits.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0066_default_const.rast2
-rw-r--r--crates/rust-analyzer/src/handlers.rs2
-rw-r--r--crates/rust-analyzer/src/to_proto.rs4
72 files changed, 183 insertions, 183 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index 01adb834c..5ea4f9f5b 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -41,7 +41,7 @@ impl<'a> SubstituteTypeParams<'a> {
41 source_scope: &'a SemanticsScope<'a>, 41 source_scope: &'a SemanticsScope<'a>,
42 // FIXME: there's implicit invariant that `trait_` and `source_scope` match... 42 // FIXME: there's implicit invariant that `trait_` and `source_scope` match...
43 trait_: hir::Trait, 43 trait_: hir::Trait,
44 impl_def: ast::ImplDef, 44 impl_def: ast::Impl,
45 ) -> SubstituteTypeParams<'a> { 45 ) -> SubstituteTypeParams<'a> {
46 let substs = get_syntactic_substs(impl_def).unwrap_or_default(); 46 let substs = get_syntactic_substs(impl_def).unwrap_or_default();
47 let generic_def: hir::GenericDef = trait_.into(); 47 let generic_def: hir::GenericDef = trait_.into();
@@ -80,7 +80,7 @@ impl<'a> SubstituteTypeParams<'a> {
80 80
81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the 81 // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
82 // trait ref, and then go from the types in the substs back to the syntax) 82 // trait ref, and then go from the types in the substs back to the syntax)
83 fn get_syntactic_substs(impl_def: ast::ImplDef) -> Option<Vec<ast::TypeRef>> { 83 fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::TypeRef>> {
84 let target_trait = impl_def.target_trait()?; 84 let target_trait = impl_def.target_trait()?;
85 let path_type = match target_trait { 85 let path_type = match target_trait {
86 ast::TypeRef::PathType(path) => path, 86 ast::TypeRef::PathType(path) => path,
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 1ab176c26..95a750aee 100644
--- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs
@@ -111,7 +111,7 @@ fn add_missing_impl_members_inner(
111 label: &'static str, 111 label: &'static str,
112) -> Option<()> { 112) -> Option<()> {
113 let _p = ra_prof::profile("add_missing_impl_members_inner"); 113 let _p = ra_prof::profile("add_missing_impl_members_inner");
114 let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?; 114 let impl_def = ctx.find_node_at_offset::<ast::Impl>()?;
115 let impl_item_list = impl_def.assoc_item_list()?; 115 let impl_item_list = impl_def.assoc_item_list()?;
116 116
117 let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?; 117 let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?;
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs
index 76144d7d2..724daa93f 100644
--- a/crates/ra_assists/src/handlers/change_visibility.rs
+++ b/crates/ra_assists/src/handlers/change_visibility.rs
@@ -1,7 +1,7 @@
1use ra_syntax::{ 1use ra_syntax::{
2 ast::{self, NameOwner, VisibilityOwner}, 2 ast::{self, NameOwner, VisibilityOwner},
3 AstNode, 3 AstNode,
4 SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT_DEF, VISIBILITY}, 4 SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY},
5 T, 5 T,
6}; 6};
7use test_utils::mark; 7use test_utils::mark;
@@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
36 36
37 let (offset, target) = if let Some(keyword) = item_keyword { 37 let (offset, target) = if let Some(keyword) = item_keyword {
38 let parent = keyword.parent(); 38 let parent = keyword.parent();
39 let def_kws = vec![CONST, STATIC, FN, MODULE, STRUCT, ENUM, TRAIT_DEF]; 39 let def_kws = vec![CONST, STATIC, FN, MODULE, STRUCT, ENUM, TRAIT];
40 // Parent is not a definition, can't add visibility 40 // Parent is not a definition, can't add visibility
41 if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { 41 if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) {
42 return None; 42 return None;
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs
index 22b47d254..3c67749ee 100644
--- a/crates/ra_assists/src/handlers/generate_new.rs
+++ b/crates/ra_assists/src/handlers/generate_new.rs
@@ -122,7 +122,7 @@ fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String {
122// 122//
123// FIXME: change the new fn checking to a more semantic approach when that's more 123// FIXME: change the new fn checking to a more semantic approach when that's more
124// viable (e.g. we process proc macros, etc) 124// viable (e.g. we process proc macros, etc)
125fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::ImplDef>> { 125fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::Impl>> {
126 let db = ctx.db(); 126 let db = ctx.db();
127 let module = strukt.syntax().ancestors().find(|node| { 127 let module = strukt.syntax().ancestors().find(|node| {
128 ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) 128 ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind())
@@ -130,7 +130,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<
130 130
131 let struct_def = ctx.sema.to_def(strukt)?; 131 let struct_def = ctx.sema.to_def(strukt)?;
132 132
133 let block = module.descendants().filter_map(ast::ImplDef::cast).find_map(|impl_blk| { 133 let block = module.descendants().filter_map(ast::Impl::cast).find_map(|impl_blk| {
134 let blk = ctx.sema.to_def(&impl_blk)?; 134 let blk = ctx.sema.to_def(&impl_blk)?;
135 135
136 // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}` 136 // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}`
@@ -158,7 +158,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<
158 Some(block) 158 Some(block)
159} 159}
160 160
161fn has_new_fn(imp: &ast::ImplDef) -> bool { 161fn has_new_fn(imp: &ast::Impl) -> bool {
162 if let Some(il) = imp.assoc_item_list() { 162 if let Some(il) = imp.assoc_item_list() {
163 for item in il.assoc_items() { 163 for item in il.assoc_items() {
164 if let ast::AssocItem::Fn(f) = item { 164 if let ast::AssocItem::Fn(f) = item {
diff --git a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
index 4ad173ef0..92a1a5925 100644
--- a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
+++ b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs
@@ -40,7 +40,7 @@ pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -
40 .filter(|lifetime| lifetime.text() == "'_")?; 40 .filter(|lifetime| lifetime.text() == "'_")?;
41 if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::Fn::cast) { 41 if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::Fn::cast) {
42 generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range()) 42 generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range())
43 } else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::ImplDef::cast) { 43 } else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::Impl::cast) {
44 generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range()) 44 generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range())
45 } else { 45 } else {
46 None 46 None
@@ -93,7 +93,7 @@ fn generate_fn_def_assist(
93/// Generate the assist for the impl def case 93/// Generate the assist for the impl def case
94fn generate_impl_def_assist( 94fn generate_impl_def_assist(
95 acc: &mut Assists, 95 acc: &mut Assists,
96 impl_def: &ast::ImplDef, 96 impl_def: &ast::Impl,
97 lifetime_loc: TextRange, 97 lifetime_loc: TextRange,
98) -> Option<()> { 98) -> Option<()> {
99 let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.generic_param_list())?; 99 let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.generic_param_list())?;
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs
index 84ac75fa8..6d394443e 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -38,8 +38,8 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
38 let anchor = match_ast! { 38 let anchor = match_ast! {
39 match parent { 39 match parent {
40 ast::Fn(it) => it.body()?.syntax().clone().into(), 40 ast::Fn(it) => it.body()?.syntax().clone().into(),
41 ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), 41 ast::Trait(it) => it.assoc_item_list()?.syntax().clone().into(),
42 ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), 42 ast::Impl(it) => it.assoc_item_list()?.syntax().clone().into(),
43 ast::Enum(it) => it.variant_list()?.syntax().clone().into(), 43 ast::Enum(it) => it.variant_list()?.syntax().clone().into(),
44 ast::Struct(it) => { 44 ast::Struct(it) => {
45 it.syntax().children_with_tokens() 45 it.syntax().children_with_tokens()
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs
index 337e3474f..bb16ebd4e 100644
--- a/crates/ra_assists/src/utils.rs
+++ b/crates/ra_assists/src/utils.rs
@@ -56,7 +56,7 @@ pub(crate) fn render_snippet(_cap: SnippetCap, node: &SyntaxNode, cursor: Cursor
56 56
57pub fn get_missing_assoc_items( 57pub fn get_missing_assoc_items(
58 sema: &Semantics<RootDatabase>, 58 sema: &Semantics<RootDatabase>,
59 impl_def: &ast::ImplDef, 59 impl_def: &ast::Impl,
60) -> Vec<hir::AssocItem> { 60) -> Vec<hir::AssocItem> {
61 // Names must be unique between constants and functions. However, type aliases 61 // Names must be unique between constants and functions. However, type aliases
62 // may share the same name as a function or constant. 62 // may share the same name as a function or constant.
@@ -109,7 +109,7 @@ pub fn get_missing_assoc_items(
109 109
110pub(crate) fn resolve_target_trait( 110pub(crate) fn resolve_target_trait(
111 sema: &Semantics<RootDatabase>, 111 sema: &Semantics<RootDatabase>,
112 impl_def: &ast::ImplDef, 112 impl_def: &ast::Impl,
113) -> Option<hir::Trait> { 113) -> Option<hir::Trait> {
114 let ast_path = impl_def 114 let ast_path = impl_def
115 .target_trait() 115 .target_trait()
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs
index 9581552e5..1c691d961 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -99,8 +99,8 @@ impl HasSource for Static {
99 } 99 }
100} 100}
101impl HasSource for Trait { 101impl HasSource for Trait {
102 type Ast = ast::TraitDef; 102 type Ast = ast::Trait;
103 fn source(self, db: &dyn HirDatabase) -> InFile<ast::TraitDef> { 103 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Trait> {
104 self.id.lookup(db.upcast()).source(db.upcast()) 104 self.id.lookup(db.upcast()).source(db.upcast())
105 } 105 }
106} 106}
@@ -120,14 +120,14 @@ impl HasSource for MacroDef {
120 } 120 }
121} 121}
122impl HasSource for ImplDef { 122impl HasSource for ImplDef {
123 type Ast = ast::ImplDef; 123 type Ast = ast::Impl;
124 fn source(self, db: &dyn HirDatabase) -> InFile<ast::ImplDef> { 124 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> {
125 self.id.lookup(db.upcast()).source(db.upcast()) 125 self.id.lookup(db.upcast()).source(db.upcast())
126 } 126 }
127} 127}
128 128
129impl HasSource for TypeParam { 129impl HasSource for TypeParam {
130 type Ast = Either<ast::TraitDef, ast::TypeParam>; 130 type Ast = Either<ast::Trait, ast::TypeParam>;
131 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { 131 fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> {
132 let child_source = self.id.parent.child_source(db.upcast()); 132 let child_source = self.id.parent.child_source(db.upcast());
133 child_source.map(|it| it[self.id.local_id].clone()) 133 child_source.map(|it| it[self.id.local_id].clone())
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 32a60b789..6f3b3dc9a 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -583,8 +583,8 @@ to_def_impls![
583 (crate::Struct, ast::Struct, struct_to_def), 583 (crate::Struct, ast::Struct, struct_to_def),
584 (crate::Enum, ast::Enum, enum_to_def), 584 (crate::Enum, ast::Enum, enum_to_def),
585 (crate::Union, ast::Union, union_to_def), 585 (crate::Union, ast::Union, union_to_def),
586 (crate::Trait, ast::TraitDef, trait_to_def), 586 (crate::Trait, ast::Trait, trait_to_def),
587 (crate::ImplDef, ast::ImplDef, impl_to_def), 587 (crate::ImplDef, ast::Impl, impl_to_def),
588 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), 588 (crate::TypeAlias, ast::TypeAlias, type_alias_to_def),
589 (crate::Const, ast::Const, const_to_def), 589 (crate::Const, ast::Const, const_to_def),
590 (crate::Static, ast::Static, static_to_def), 590 (crate::Static, ast::Static, 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 782a03f9e..d1994e2e7 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -65,10 +65,10 @@ impl SourceToDefCtx<'_, '_> {
65 Some(ModuleId { krate: parent_module.krate, local_id: child_id }) 65 Some(ModuleId { krate: parent_module.krate, local_id: child_id })
66 } 66 }
67 67
68 pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> { 68 pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> {
69 self.to_def(src, keys::TRAIT) 69 self.to_def(src, keys::TRAIT)
70 } 70 }
71 pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { 71 pub(super) fn impl_to_def(&mut self, src: InFile<ast::Impl>) -> Option<ImplId> {
72 self.to_def(src, keys::IMPL) 72 self.to_def(src, keys::IMPL)
73 } 73 }
74 pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> { 74 pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> {
@@ -154,11 +154,11 @@ impl SourceToDefCtx<'_, '_> {
154 let def = self.module_to_def(container.with_value(it))?; 154 let def = self.module_to_def(container.with_value(it))?;
155 def.into() 155 def.into()
156 }, 156 },
157 ast::TraitDef(it) => { 157 ast::Trait(it) => {
158 let def = self.trait_to_def(container.with_value(it))?; 158 let def = self.trait_to_def(container.with_value(it))?;
159 def.into() 159 def.into()
160 }, 160 },
161 ast::ImplDef(it) => { 161 ast::Impl(it) => {
162 let def = self.impl_to_def(container.with_value(it))?; 162 let def = self.impl_to_def(container.with_value(it))?;
163 def.into() 163 def.into()
164 }, 164 },
@@ -207,9 +207,9 @@ impl SourceToDefCtx<'_, '_> {
207 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), 207 ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(),
208 ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), 208 ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(),
209 ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), 209 ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(),
210 ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), 210 ast::Trait(it) => self.trait_to_def(container.with_value(it))?.into(),
211 ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), 211 ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(),
212 ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), 212 ast::Impl(it) => self.impl_to_def(container.with_value(it))?.into(),
213 _ => continue, 213 _ => continue,
214 } 214 }
215 }; 215 };
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs
index 4a26e6397..78f6da5b8 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -664,12 +664,12 @@ impl ExprCollector<'_> {
664 let id = self.find_inner_item(&def)?; 664 let id = self.find_inner_item(&def)?;
665 (UnionLoc { container, id }.intern(self.db).into(), def.name()) 665 (UnionLoc { container, id }.intern(self.db).into(), def.name())
666 } 666 }
667 ast::Item::TraitDef(def) => { 667 ast::Item::Trait(def) => {
668 let id = self.find_inner_item(&def)?; 668 let id = self.find_inner_item(&def)?;
669 (TraitLoc { container, id }.intern(self.db).into(), def.name()) 669 (TraitLoc { container, id }.intern(self.db).into(), def.name())
670 } 670 }
671 ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks 671 ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks
672 ast::Item::ImplDef(_) 672 ast::Item::Impl(_)
673 | ast::Item::Use(_) 673 | ast::Item::Use(_)
674 | ast::Item::ExternCrate(_) 674 | ast::Item::ExternCrate(_)
675 | ast::Item::Module(_) 675 | ast::Item::Module(_)
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs
index 5fa2fbb3f..8ea61fcf2 100644
--- a/crates/ra_hir_def/src/generics.rs
+++ b/crates/ra_hir_def/src/generics.rs
@@ -66,7 +66,7 @@ pub enum WherePredicateTarget {
66 TypeParam(LocalTypeParamId), 66 TypeParam(LocalTypeParamId),
67} 67}
68 68
69type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::TraitDef, ast::TypeParam>>; 69type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::Trait, ast::TypeParam>>;
70 70
71impl GenericParams { 71impl GenericParams {
72 pub(crate) fn generic_params_query( 72 pub(crate) fn generic_params_query(
@@ -317,7 +317,7 @@ impl GenericParams {
317 317
318impl HasChildSource for GenericDefId { 318impl HasChildSource for GenericDefId {
319 type ChildId = LocalTypeParamId; 319 type ChildId = LocalTypeParamId;
320 type Value = Either<ast::TraitDef, ast::TypeParam>; 320 type Value = Either<ast::Trait, ast::TypeParam>;
321 fn child_source(&self, db: &dyn DefDatabase) -> InFile<SourceMap> { 321 fn child_source(&self, db: &dyn DefDatabase) -> InFile<SourceMap> {
322 let (_, sm) = GenericParams::new(db, *self); 322 let (_, sm) = GenericParams::new(db, *self);
323 sm 323 sm
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs
index c478a9909..63b56405c 100644
--- a/crates/ra_hir_def/src/item_tree.rs
+++ b/crates/ra_hir_def/src/item_tree.rs
@@ -419,8 +419,8 @@ mod_items! {
419 Enum in enums -> ast::Enum, 419 Enum in enums -> ast::Enum,
420 Const in consts -> ast::Const, 420 Const in consts -> ast::Const,
421 Static in statics -> ast::Static, 421 Static in statics -> ast::Static,
422 Trait in traits -> ast::TraitDef, 422 Trait in traits -> ast::Trait,
423 Impl in impls -> ast::ImplDef, 423 Impl in impls -> ast::Impl,
424 TypeAlias in type_aliases -> ast::TypeAlias, 424 TypeAlias in type_aliases -> ast::TypeAlias,
425 Mod in mods -> ast::Module, 425 Mod in mods -> ast::Module,
426 MacroCall in macro_calls -> ast::MacroCall, 426 MacroCall in macro_calls -> ast::MacroCall,
@@ -571,7 +571,7 @@ pub struct Trait {
571 pub generic_params: GenericParamsId, 571 pub generic_params: GenericParamsId,
572 pub auto: bool, 572 pub auto: bool,
573 pub items: Box<[AssocItem]>, 573 pub items: Box<[AssocItem]>,
574 pub ast_id: FileAstId<ast::TraitDef>, 574 pub ast_id: FileAstId<ast::Trait>,
575} 575}
576 576
577#[derive(Debug, Clone, Eq, PartialEq)] 577#[derive(Debug, Clone, Eq, PartialEq)]
@@ -581,7 +581,7 @@ pub struct Impl {
581 pub target_type: TypeRef, 581 pub target_type: TypeRef,
582 pub is_negative: bool, 582 pub is_negative: bool,
583 pub items: Box<[AssocItem]>, 583 pub items: Box<[AssocItem]>,
584 pub ast_id: FileAstId<ast::ImplDef>, 584 pub ast_id: FileAstId<ast::Impl>,
585} 585}
586 586
587#[derive(Debug, Clone, PartialEq, Eq)] 587#[derive(Debug, Clone, PartialEq, Eq)]
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs
index a94548e5d..b0cf94956 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -95,7 +95,7 @@ impl Ctx {
95 95
96 // These are handled in their respective `lower_X` method (since we can't just blindly 96 // These are handled in their respective `lower_X` method (since we can't just blindly
97 // walk them). 97 // walk them).
98 ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} 98 ast::Item::Trait(_) | ast::Item::Impl(_) | ast::Item::ExternBlock(_) => {}
99 99
100 // These don't have inner items. 100 // These don't have inner items.
101 ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} 101 ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {}
@@ -111,8 +111,8 @@ impl Ctx {
111 ast::Item::Static(ast) => self.lower_static(ast).map(Into::into), 111 ast::Item::Static(ast) => self.lower_static(ast).map(Into::into),
112 ast::Item::Const(ast) => Some(self.lower_const(ast).into()), 112 ast::Item::Const(ast) => Some(self.lower_const(ast).into()),
113 ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), 113 ast::Item::Module(ast) => self.lower_module(ast).map(Into::into),
114 ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), 114 ast::Item::Trait(ast) => self.lower_trait(ast).map(Into::into),
115 ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), 115 ast::Item::Impl(ast) => self.lower_impl(ast).map(Into::into),
116 ast::Item::Use(ast) => Some(ModItems( 116 ast::Item::Use(ast) => Some(ModItems(
117 self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), 117 self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(),
118 )), 118 )),
@@ -413,7 +413,7 @@ impl Ctx {
413 Some(id(self.data().mods.alloc(res))) 413 Some(id(self.data().mods.alloc(res)))
414 } 414 }
415 415
416 fn lower_trait(&mut self, trait_def: &ast::TraitDef) -> Option<FileItemTreeId<Trait>> { 416 fn lower_trait(&mut self, trait_def: &ast::Trait) -> Option<FileItemTreeId<Trait>> {
417 let name = trait_def.name()?.as_name(); 417 let name = trait_def.name()?.as_name();
418 let visibility = self.lower_visibility(trait_def); 418 let visibility = self.lower_visibility(trait_def);
419 let generic_params = 419 let generic_params =
@@ -445,7 +445,7 @@ impl Ctx {
445 Some(id(self.data().traits.alloc(res))) 445 Some(id(self.data().traits.alloc(res)))
446 } 446 }
447 447
448 fn lower_impl(&mut self, impl_def: &ast::ImplDef) -> Option<FileItemTreeId<Impl>> { 448 fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> {
449 let generic_params = 449 let generic_params =
450 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); 450 self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def);
451 let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); 451 let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr));
@@ -698,7 +698,7 @@ enum GenericsOwner<'a> {
698 Enum, 698 Enum,
699 Union, 699 Union,
700 /// The `TraitDef` is needed to fill the source map for the implicit `Self` parameter. 700 /// The `TraitDef` is needed to fill the source map for the implicit `Self` parameter.
701 Trait(&'a ast::TraitDef), 701 Trait(&'a ast::Trait),
702 TypeAlias, 702 TypeAlias,
703 Impl, 703 Impl,
704} 704}
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index e61ce58bc..a81497fa8 100644
--- a/crates/ra_hir_def/src/item_tree/tests.rs
+++ b/crates/ra_hir_def/src/item_tree/tests.rs
@@ -234,7 +234,7 @@ fn smoke() {
234 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }] 234 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }]
235 ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ExternCrate>(1) } 235 ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ExternCrate>(1) }
236 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }] 236 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }]
237 Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) } 237 Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(2) }
238 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }] 238 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }]
239 > TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) } 239 > TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) }
240 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }] 240 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }]
@@ -274,7 +274,7 @@ fn simple_inner_items() {
274 inner attrs: Attrs { entries: None } 274 inner attrs: Attrs { entries: None }
275 275
276 top-level items: 276 top-level items:
277 Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } 277 Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
278 > Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } 278 > Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
279 279
280 inner items: 280 inner items:
@@ -327,7 +327,7 @@ fn trait_attrs() {
327 327
328 top-level items: 328 top-level items:
329 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }] 329 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }]
330 Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(0) } 330 Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(0) }
331 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] 331 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
332 > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } 332 > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
333 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] 333 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
@@ -353,7 +353,7 @@ fn impl_attrs() {
353 353
354 top-level items: 354 top-level items:
355 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }] 355 #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }]
356 Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } 356 Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
357 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] 357 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }]
358 > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } 358 > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) }
359 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] 359 > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }]
@@ -432,7 +432,7 @@ fn assoc_item_macros() {
432 inner attrs: Attrs { entries: None } 432 inner attrs: Attrs { entries: None }
433 433
434 top-level items: 434 top-level items:
435 Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } 435 Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) }
436 > MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::MacroCall>(1) } 436 > MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::MacroCall>(1) }
437 "#]], 437 "#]],
438 ); 438 );
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs
index f75e3bb50..441bdbead 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -18,8 +18,8 @@ pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
18pub const CONST: Key<ast::Const, ConstId> = Key::new(); 18pub const CONST: Key<ast::Const, ConstId> = Key::new();
19pub const STATIC: Key<ast::Static, StaticId> = Key::new(); 19pub const STATIC: Key<ast::Static, StaticId> = Key::new();
20pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new(); 20pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); 21pub const IMPL: Key<ast::Impl, ImplId> = Key::new();
22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); 22pub const TRAIT: Key<ast::Trait, TraitId> = Key::new();
23pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); 23pub const STRUCT: Key<ast::Struct, StructId> = Key::new();
24pub const UNION: Key<ast::Union, UnionId> = Key::new(); 24pub const UNION: Key<ast::Union, UnionId> = Key::new();
25pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); 25pub const ENUM: Key<ast::Enum, EnumId> = Key::new();
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs
index 87221d964..d9a0ef167 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`, `TYPE_ALIAS`, or `CONST` node 5//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node
6//! and an direct child of an `IMPL_DEF`. 6//! and an direct child of an `IMPL`.
7//! 7//!
8//! # Examples 8//! # Examples
9//! 9//!
@@ -34,7 +34,7 @@
34use hir::{self, Docs, HasSource}; 34use hir::{self, Docs, HasSource};
35use ra_assists::utils::get_missing_assoc_items; 35use ra_assists::utils::get_missing_assoc_items;
36use ra_syntax::{ 36use ra_syntax::{
37 ast::{self, edit, ImplDef}, 37 ast::{self, edit, Impl},
38 AstNode, SyntaxKind, SyntaxNode, TextRange, T, 38 AstNode, SyntaxKind, SyntaxNode, TextRange, T,
39}; 39};
40use ra_text_edit::TextEdit; 40use ra_text_edit::TextEdit;
@@ -104,7 +104,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
104 } 104 }
105} 105}
106 106
107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { 107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, Impl)> {
108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { 108 let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() {
109 SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { 109 SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => {
110 Some((p, 2)) 110 Some((p, 2))
@@ -114,7 +114,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> {
114 })?; 114 })?;
115 let impl_def = (0..impl_def_offset - 1) 115 let impl_def = (0..impl_def_offset - 1)
116 .try_fold(trigger.parent()?, |t, _| t.parent()) 116 .try_fold(trigger.parent()?, |t, _| t.parent())
117 .and_then(ast::ImplDef::cast)?; 117 .and_then(ast::Impl::cast)?;
118 Some((trigger, impl_def)) 118 Some((trigger, impl_def))
119} 119}
120 120
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index c8704eb3e..2113abbb2 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -40,7 +40,7 @@ pub(crate) struct CompletionContext<'a> {
40 pub(super) record_lit_syntax: Option<ast::RecordExpr>, 40 pub(super) record_lit_syntax: Option<ast::RecordExpr>,
41 pub(super) record_pat_syntax: Option<ast::RecordPat>, 41 pub(super) record_pat_syntax: Option<ast::RecordPat>,
42 pub(super) record_field_syntax: Option<ast::RecordExprField>, 42 pub(super) record_field_syntax: Option<ast::RecordExprField>,
43 pub(super) impl_def: Option<ast::ImplDef>, 43 pub(super) impl_def: Option<ast::Impl>,
44 /// FIXME: `ActiveParameter` is string-based, which is very very wrong 44 /// FIXME: `ActiveParameter` is string-based, which is very very wrong
45 pub(super) active_parameter: Option<ActiveParameter>, 45 pub(super) active_parameter: Option<ActiveParameter>,
46 pub(super) is_param: bool, 46 pub(super) is_param: bool,
@@ -325,7 +325,7 @@ impl<'a> CompletionContext<'a> {
325 .sema 325 .sema
326 .ancestors_with_macros(self.token.parent()) 326 .ancestors_with_macros(self.token.parent())
327 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) 327 .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE)
328 .find_map(ast::ImplDef::cast); 328 .find_map(ast::Impl::cast);
329 329
330 let top_node = name_ref 330 let top_node = name_ref
331 .syntax() 331 .syntax()
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs
index b8408da4e..a68861e1c 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -15,7 +15,7 @@ pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool {
15 not_same_range_ancestor(element) 15 not_same_range_ancestor(element)
16 .filter(|it| it.kind() == ASSOC_ITEM_LIST) 16 .filter(|it| it.kind() == ASSOC_ITEM_LIST)
17 .and_then(|it| it.parent()) 17 .and_then(|it| it.parent())
18 .filter(|it| it.kind() == TRAIT_DEF) 18 .filter(|it| it.kind() == TRAIT)
19 .is_some() 19 .is_some()
20} 20}
21#[test] 21#[test]
@@ -27,7 +27,7 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool {
27 not_same_range_ancestor(element) 27 not_same_range_ancestor(element)
28 .filter(|it| it.kind() == ASSOC_ITEM_LIST) 28 .filter(|it| it.kind() == ASSOC_ITEM_LIST)
29 .and_then(|it| it.parent()) 29 .and_then(|it| it.parent())
30 .filter(|it| it.kind() == IMPL_DEF) 30 .filter(|it| it.kind() == IMPL)
31 .is_some() 31 .is_some()
32} 32}
33#[test] 33#[test]
@@ -113,7 +113,7 @@ fn test_if_is_prev() {
113} 113}
114 114
115pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { 115pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool {
116 previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT_DEF).is_some() 116 previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT).is_some()
117} 117}
118#[test] 118#[test]
119fn test_has_trait_as_prev_sibling() { 119fn test_has_trait_as_prev_sibling() {
@@ -121,7 +121,7 @@ fn test_has_trait_as_prev_sibling() {
121} 121}
122 122
123pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { 123pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool {
124 previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL_DEF).is_some() 124 previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL).is_some()
125} 125}
126#[test] 126#[test]
127fn test_has_impl_as_prev_sibling() { 127fn test_has_impl_as_prev_sibling() {
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs
index 9e2c01245..45fbc86ef 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -382,7 +382,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option
382 ast::Fn(it) => it.doc_comment_text(), 382 ast::Fn(it) => it.doc_comment_text(),
383 ast::Struct(it) => it.doc_comment_text(), 383 ast::Struct(it) => it.doc_comment_text(),
384 ast::Enum(it) => it.doc_comment_text(), 384 ast::Enum(it) => it.doc_comment_text(),
385 ast::TraitDef(it) => it.doc_comment_text(), 385 ast::Trait(it) => it.doc_comment_text(),
386 ast::Module(it) => it.doc_comment_text(), 386 ast::Module(it) => it.doc_comment_text(),
387 ast::TypeAlias(it) => it.doc_comment_text(), 387 ast::TypeAlias(it) => it.doc_comment_text(),
388 ast::Const(it) => it.doc_comment_text(), 388 ast::Const(it) => it.doc_comment_text(),
@@ -407,7 +407,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) ->
407 ast::Fn(it) => it.short_label(), 407 ast::Fn(it) => it.short_label(),
408 ast::Struct(it) => it.short_label(), 408 ast::Struct(it) => it.short_label(),
409 ast::Enum(it) => it.short_label(), 409 ast::Enum(it) => it.short_label(),
410 ast::TraitDef(it) => it.short_label(), 410 ast::Trait(it) => it.short_label(),
411 ast::Module(it) => it.short_label(), 411 ast::Module(it) => it.short_label(),
412 ast::TypeAlias(it) => it.short_label(), 412 ast::TypeAlias(it) => it.short_label(),
413 ast::Const(it) => it.short_label(), 413 ast::Const(it) => it.short_label(),
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index 282f362f2..c600908a4 100644
--- a/crates/ra_ide/src/display/short_label.rs
+++ b/crates/ra_ide/src/display/short_label.rs
@@ -31,7 +31,7 @@ impl ShortLabel for ast::Enum {
31 } 31 }
32} 32}
33 33
34impl ShortLabel for ast::TraitDef { 34impl ShortLabel for ast::Trait {
35 fn short_label(&self) -> Option<String> { 35 fn short_label(&self) -> Option<String> {
36 if self.unsafe_token().is_some() { 36 if self.unsafe_token().is_some() {
37 short_label_from_node(self, "unsafe trait ") 37 short_label_from_node(self, "unsafe trait ")
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index 77384b6ec..7d378f2d0 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -130,7 +130,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
130 ast::Union(it) => decl(it), 130 ast::Union(it) => decl(it),
131 ast::Enum(it) => decl(it), 131 ast::Enum(it) => decl(it),
132 ast::Variant(it) => decl(it), 132 ast::Variant(it) => decl(it),
133 ast::TraitDef(it) => decl(it), 133 ast::Trait(it) => decl(it),
134 ast::Module(it) => decl(it), 134 ast::Module(it) => decl(it),
135 ast::TypeAlias(it) => { 135 ast::TypeAlias(it) => {
136 let ty = it.type_ref(); 136 let ty = it.type_ref();
@@ -139,7 +139,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
139 ast::RecordField(it) => decl_with_ascription(it), 139 ast::RecordField(it) => decl_with_ascription(it),
140 ast::Const(it) => decl_with_ascription(it), 140 ast::Const(it) => decl_with_ascription(it),
141 ast::Static(it) => decl_with_ascription(it), 141 ast::Static(it) => decl_with_ascription(it),
142 ast::ImplDef(it) => { 142 ast::Impl(it) => {
143 let target_type = it.target_type()?; 143 let target_type = it.target_type()?;
144 let target_trait = it.target_trait(); 144 let target_trait = it.target_trait();
145 let label = match target_trait { 145 let label = match target_trait {
@@ -372,7 +372,7 @@ fn very_obsolete() {}
372 label: "impl E", 372 label: "impl E",
373 navigation_range: 239..240, 373 navigation_range: 239..240,
374 node_range: 234..243, 374 node_range: 234..243,
375 kind: IMPL_DEF, 375 kind: IMPL,
376 detail: None, 376 detail: None,
377 deprecated: false, 377 deprecated: false,
378 }, 378 },
@@ -381,7 +381,7 @@ fn very_obsolete() {}
381 label: "impl fmt::Debug for E", 381 label: "impl fmt::Debug for E",
382 navigation_range: 265..266, 382 navigation_range: 265..266,
383 node_range: 245..269, 383 node_range: 245..269,
384 kind: IMPL_DEF, 384 kind: IMPL,
385 detail: None, 385 detail: None,
386 deprecated: false, 386 deprecated: false,
387 }, 387 },
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs
index e2f7e6373..9912b7142 100644
--- a/crates/ra_ide/src/goto_implementation.rs
+++ b/crates/ra_ide/src/goto_implementation.rs
@@ -28,7 +28,7 @@ pub(crate) fn goto_implementation(
28 nominal_def.syntax().text_range(), 28 nominal_def.syntax().text_range(),
29 impls_for_def(&sema, &nominal_def, krate)?, 29 impls_for_def(&sema, &nominal_def, krate)?,
30 )); 30 ));
31 } else if let Some(trait_def) = find_node_at_offset::<ast::TraitDef>(&syntax, position.offset) { 31 } else if let Some(trait_def) = find_node_at_offset::<ast::Trait>(&syntax, position.offset) {
32 return Some(RangeInfo::new( 32 return Some(RangeInfo::new(
33 trait_def.syntax().text_range(), 33 trait_def.syntax().text_range(),
34 impls_for_trait(&sema, &trait_def, krate)?, 34 impls_for_trait(&sema, &trait_def, krate)?,
@@ -62,7 +62,7 @@ fn impls_for_def(
62 62
63fn impls_for_trait( 63fn impls_for_trait(
64 sema: &Semantics<RootDatabase>, 64 sema: &Semantics<RootDatabase>,
65 node: &ast::TraitDef, 65 node: &ast::Trait,
66 krate: Crate, 66 krate: Crate,
67) -> Option<Vec<NavigationTarget>> { 67) -> Option<Vec<NavigationTarget>> {
68 let tr = sema.to_def(node)?; 68 let tr = sema.to_def(node)?;
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs
index 83228af2e..aa48cb412 100644
--- a/crates/ra_ide/src/hover.rs
+++ b/crates/ra_ide/src/hover.rs
@@ -1678,7 +1678,7 @@ fn main() { let s<|>t = foo(); }
1678 6..9, 1678 6..9,
1679 ), 1679 ),
1680 name: "Foo", 1680 name: "Foo",
1681 kind: TRAIT_DEF, 1681 kind: TRAIT,
1682 container_name: None, 1682 container_name: None,
1683 description: Some( 1683 description: Some(
1684 "trait Foo", 1684 "trait Foo",
@@ -1718,7 +1718,7 @@ fn main() { let s<|>t = foo(); }
1718 6..9, 1718 6..9,
1719 ), 1719 ),
1720 name: "Foo", 1720 name: "Foo",
1721 kind: TRAIT_DEF, 1721 kind: TRAIT,
1722 container_name: None, 1722 container_name: None,
1723 description: Some( 1723 description: Some(
1724 "trait Foo", 1724 "trait Foo",
@@ -1777,7 +1777,7 @@ fn main() { let s<|>t = foo(); }
1777 6..9, 1777 6..9,
1778 ), 1778 ),
1779 name: "Foo", 1779 name: "Foo",
1780 kind: TRAIT_DEF, 1780 kind: TRAIT,
1781 container_name: None, 1781 container_name: None,
1782 description: Some( 1782 description: Some(
1783 "trait Foo", 1783 "trait Foo",
@@ -1796,7 +1796,7 @@ fn main() { let s<|>t = foo(); }
1796 19..22, 1796 19..22,
1797 ), 1797 ),
1798 name: "Bar", 1798 name: "Bar",
1799 kind: TRAIT_DEF, 1799 kind: TRAIT,
1800 container_name: None, 1800 container_name: None,
1801 description: Some( 1801 description: Some(
1802 "trait Bar", 1802 "trait Bar",
@@ -1839,7 +1839,7 @@ fn main() { let s<|>t = foo(); }
1839 6..9, 1839 6..9,
1840 ), 1840 ),
1841 name: "Foo", 1841 name: "Foo",
1842 kind: TRAIT_DEF, 1842 kind: TRAIT,
1843 container_name: None, 1843 container_name: None,
1844 description: Some( 1844 description: Some(
1845 "trait Foo", 1845 "trait Foo",
@@ -1858,7 +1858,7 @@ fn main() { let s<|>t = foo(); }
1858 22..25, 1858 22..25,
1859 ), 1859 ),
1860 name: "Bar", 1860 name: "Bar",
1861 kind: TRAIT_DEF, 1861 kind: TRAIT,
1862 container_name: None, 1862 container_name: None,
1863 description: Some( 1863 description: Some(
1864 "trait Bar", 1864 "trait Bar",
@@ -1933,7 +1933,7 @@ fn foo(ar<|>g: &impl Foo) {}
1933 6..9, 1933 6..9,
1934 ), 1934 ),
1935 name: "Foo", 1935 name: "Foo",
1936 kind: TRAIT_DEF, 1936 kind: TRAIT,
1937 container_name: None, 1937 container_name: None,
1938 description: Some( 1938 description: Some(
1939 "trait Foo", 1939 "trait Foo",
@@ -1973,7 +1973,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
1973 6..9, 1973 6..9,
1974 ), 1974 ),
1975 name: "Foo", 1975 name: "Foo",
1976 kind: TRAIT_DEF, 1976 kind: TRAIT,
1977 container_name: None, 1977 container_name: None,
1978 description: Some( 1978 description: Some(
1979 "trait Foo", 1979 "trait Foo",
@@ -1992,7 +1992,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {}
1992 19..22, 1992 19..22,
1993 ), 1993 ),
1994 name: "Bar", 1994 name: "Bar",
1995 kind: TRAIT_DEF, 1995 kind: TRAIT,
1996 container_name: None, 1996 container_name: None,
1997 description: Some( 1997 description: Some(
1998 "trait Bar", 1998 "trait Bar",
@@ -2049,7 +2049,7 @@ fn foo(ar<|>g: &impl Foo<S>) {}
2049 6..9, 2049 6..9,
2050 ), 2050 ),
2051 name: "Foo", 2051 name: "Foo",
2052 kind: TRAIT_DEF, 2052 kind: TRAIT,
2053 container_name: None, 2053 container_name: None,
2054 description: Some( 2054 description: Some(
2055 "trait Foo", 2055 "trait Foo",
@@ -2130,7 +2130,7 @@ fn main() { let s<|>t = foo(); }
2130 6..9, 2130 6..9,
2131 ), 2131 ),
2132 name: "Foo", 2132 name: "Foo",
2133 kind: TRAIT_DEF, 2133 kind: TRAIT,
2134 container_name: None, 2134 container_name: None,
2135 description: Some( 2135 description: Some(
2136 "trait Foo", 2136 "trait Foo",
@@ -2167,7 +2167,7 @@ fn foo(ar<|>g: &dyn Foo) {}
2167 6..9, 2167 6..9,
2168 ), 2168 ),
2169 name: "Foo", 2169 name: "Foo",
2170 kind: TRAIT_DEF, 2170 kind: TRAIT,
2171 container_name: None, 2171 container_name: None,
2172 description: Some( 2172 description: Some(
2173 "trait Foo", 2173 "trait Foo",
@@ -2205,7 +2205,7 @@ fn foo(ar<|>g: &dyn Foo<S>) {}
2205 6..9, 2205 6..9,
2206 ), 2206 ),
2207 name: "Foo", 2207 name: "Foo",
2208 kind: TRAIT_DEF, 2208 kind: TRAIT,
2209 container_name: None, 2209 container_name: None,
2210 description: Some( 2210 description: Some(
2211 "trait Foo", 2211 "trait Foo",
@@ -2265,7 +2265,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2265 6..15, 2265 6..15,
2266 ), 2266 ),
2267 name: "ImplTrait", 2267 name: "ImplTrait",
2268 kind: TRAIT_DEF, 2268 kind: TRAIT,
2269 container_name: None, 2269 container_name: None,
2270 description: Some( 2270 description: Some(
2271 "trait ImplTrait", 2271 "trait ImplTrait",
@@ -2303,7 +2303,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {}
2303 28..36, 2303 28..36,
2304 ), 2304 ),
2305 name: "DynTrait", 2305 name: "DynTrait",
2306 kind: TRAIT_DEF, 2306 kind: TRAIT,
2307 container_name: None, 2307 container_name: None,
2308 description: Some( 2308 description: Some(
2309 "trait DynTrait", 2309 "trait DynTrait",
@@ -2370,7 +2370,7 @@ fn main() { let s<|>t = test().get(); }
2370 6..9, 2370 6..9,
2371 ), 2371 ),
2372 name: "Foo", 2372 name: "Foo",
2373 kind: TRAIT_DEF, 2373 kind: TRAIT,
2374 container_name: None, 2374 container_name: None,
2375 description: Some( 2375 description: Some(
2376 "trait Foo", 2376 "trait Foo",
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index d8ffb8c84..d330109f1 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -192,15 +192,14 @@ fn text_edit_from_self_param(
192 self_param: &ast::SelfParam, 192 self_param: &ast::SelfParam,
193 new_name: &str, 193 new_name: &str,
194) -> Option<TextEdit> { 194) -> Option<TextEdit> {
195 fn target_type_name(impl_def: &ast::ImplDef) -> Option<String> { 195 fn target_type_name(impl_def: &ast::Impl) -> Option<String> {
196 if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { 196 if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() {
197 return Some(p.path()?.segment()?.name_ref()?.text().to_string()); 197 return Some(p.path()?.segment()?.name_ref()?.text().to_string());
198 } 198 }
199 None 199 None
200 } 200 }
201 201
202 let impl_def = 202 let impl_def = find_node_at_offset::<ast::Impl>(syn, self_param.syntax().text_range().start())?;
203 find_node_at_offset::<ast::ImplDef>(syn, self_param.syntax().text_range().start())?;
204 let type_name = target_type_name(&impl_def)?; 203 let type_name = target_type_name(&impl_def)?;
205 204
206 let mut replacement_text = String::from(new_name); 205 let mut replacement_text = String::from(new_name);
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 19ec73d2a..e3a96f9d5 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -647,7 +647,7 @@ fn highlight_element(
647 647
648fn is_child_of_impl(element: &SyntaxElement) -> bool { 648fn is_child_of_impl(element: &SyntaxElement) -> bool {
649 match element.parent() { 649 match element.parent() {
650 Some(e) => e.kind() == IMPL_DEF, 650 Some(e) => e.kind() == IMPL,
651 _ => false, 651 _ => false,
652 } 652 }
653} 653}
@@ -708,7 +708,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight {
708 STRUCT => HighlightTag::Struct, 708 STRUCT => HighlightTag::Struct,
709 ENUM => HighlightTag::Enum, 709 ENUM => HighlightTag::Enum,
710 UNION => HighlightTag::Union, 710 UNION => HighlightTag::Union,
711 TRAIT_DEF => HighlightTag::Trait, 711 TRAIT => HighlightTag::Trait,
712 TYPE_ALIAS => HighlightTag::TypeAlias, 712 TYPE_ALIAS => HighlightTag::TypeAlias,
713 TYPE_PARAM => HighlightTag::TypeParam, 713 TYPE_PARAM => HighlightTag::TypeParam,
714 RECORD_FIELD => HighlightTag::Field, 714 RECORD_FIELD => HighlightTag::Field,
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index b908bd741..df56f2d9e 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -162,7 +162,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option
162 let def: hir::Enum = sema.to_def(&it)?; 162 let def: hir::Enum = sema.to_def(&it)?;
163 Some(NameClass::Definition(Definition::ModuleDef(def.into()))) 163 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
164 }, 164 },
165 ast::TraitDef(it) => { 165 ast::Trait(it) => {
166 let def: hir::Trait = sema.to_def(&it)?; 166 let def: hir::Trait = sema.to_def(&it)?;
167 Some(NameClass::Definition(Definition::ModuleDef(def.into()))) 167 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
168 }, 168 },
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs
index 41b8d07f4..35a2c5be3 100644
--- a/crates/ra_ide_db/src/symbol_index.rs
+++ b/crates/ra_ide_db/src/symbol_index.rs
@@ -344,7 +344,7 @@ impl Query {
344} 344}
345 345
346fn is_type(kind: SyntaxKind) -> bool { 346fn is_type(kind: SyntaxKind) -> bool {
347 matches!(kind, STRUCT | ENUM | TRAIT_DEF | TYPE_ALIAS) 347 matches!(kind, STRUCT | ENUM | TRAIT | TYPE_ALIAS)
348} 348}
349 349
350/// The actual data that is stored in the index. It should be as compact as 350/// The actual data that is stored in the index. It should be as compact as
@@ -400,7 +400,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
400 ast::Fn(it) => decl(it), 400 ast::Fn(it) => decl(it),
401 ast::Struct(it) => decl(it), 401 ast::Struct(it) => decl(it),
402 ast::Enum(it) => decl(it), 402 ast::Enum(it) => decl(it),
403 ast::TraitDef(it) => decl(it), 403 ast::Trait(it) => decl(it),
404 ast::Module(it) => decl(it), 404 ast::Module(it) => decl(it),
405 ast::TypeAlias(it) => decl(it), 405 ast::TypeAlias(it) => decl(it),
406 ast::Const(it) => decl(it), 406 ast::Const(it) => decl(it),
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index 22a7acdf3..c2e1d701e 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -150,8 +150,8 @@ pub(crate) fn reparser(
150 EXTERN_ITEM_LIST => items::extern_item_list, 150 EXTERN_ITEM_LIST => items::extern_item_list,
151 TOKEN_TREE if first_child? == T!['{'] => items::token_tree, 151 TOKEN_TREE if first_child? == T!['{'] => items::token_tree,
152 ASSOC_ITEM_LIST => match parent? { 152 ASSOC_ITEM_LIST => match parent? {
153 IMPL_DEF => items::impl_item_list, 153 IMPL => items::impl_item_list,
154 TRAIT_DEF => items::trait_item_list, 154 TRAIT => items::trait_item_list,
155 _ => return None, 155 _ => return None,
156 }, 156 },
157 ITEM_LIST => items::mod_item_list, 157 ITEM_LIST => items::mod_item_list,
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 664b23f6a..cca524cea 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -193,7 +193,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
193 // unsafe auto trait T {} 193 // unsafe auto trait T {}
194 T![trait] => { 194 T![trait] => {
195 traits::trait_def(p); 195 traits::trait_def(p);
196 m.complete(p, TRAIT_DEF); 196 m.complete(p, TRAIT);
197 } 197 }
198 198
199 // test unsafe_impl 199 // test unsafe_impl
@@ -221,7 +221,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
221 // unsafe default impl Foo {} 221 // unsafe default impl Foo {}
222 T![impl] => { 222 T![impl] => {
223 traits::impl_def(p); 223 traits::impl_def(p);
224 m.complete(p, IMPL_DEF); 224 m.complete(p, IMPL);
225 } 225 }
226 226
227 // test existential_type 227 // test existential_type
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 64889676e..d1b22f08a 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -133,8 +133,8 @@ pub enum SyntaxKind {
133 USE, 133 USE,
134 STATIC, 134 STATIC,
135 CONST, 135 CONST,
136 TRAIT_DEF, 136 TRAIT,
137 IMPL_DEF, 137 IMPL,
138 TYPE_ALIAS, 138 TYPE_ALIAS,
139 MACRO_CALL, 139 MACRO_CALL,
140 TOKEN_TREE, 140 TOKEN_TREE,
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs
index 00a70fce0..ba00742f0 100644
--- a/crates/ra_syntax/src/ast/generated/nodes.rs
+++ b/crates/ra_syntax/src/ast/generated/nodes.rs
@@ -100,17 +100,18 @@ impl Fn {
100 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } 100 pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
101} 101}
102#[derive(Debug, Clone, PartialEq, Eq, Hash)] 102#[derive(Debug, Clone, PartialEq, Eq, Hash)]
103pub struct ImplDef { 103pub struct Impl {
104 pub(crate) syntax: SyntaxNode, 104 pub(crate) syntax: SyntaxNode,
105} 105}
106impl ast::AttrsOwner for ImplDef {} 106impl ast::AttrsOwner for Impl {}
107impl ast::VisibilityOwner for ImplDef {} 107impl ast::VisibilityOwner for Impl {}
108impl ast::GenericParamsOwner for ImplDef {} 108impl ast::GenericParamsOwner for Impl {}
109impl ImplDef { 109impl Impl {
110 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
111 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } 110 pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) }
112 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 111 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
113 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } 112 pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) }
113 pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) }
114 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
114 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } 115 pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) }
115 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } 116 pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) }
116 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } 117 pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
@@ -169,15 +170,15 @@ impl Struct {
169 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } 170 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
170} 171}
171#[derive(Debug, Clone, PartialEq, Eq, Hash)] 172#[derive(Debug, Clone, PartialEq, Eq, Hash)]
172pub struct TraitDef { 173pub struct Trait {
173 pub(crate) syntax: SyntaxNode, 174 pub(crate) syntax: SyntaxNode,
174} 175}
175impl ast::AttrsOwner for TraitDef {} 176impl ast::AttrsOwner for Trait {}
176impl ast::NameOwner for TraitDef {} 177impl ast::NameOwner for Trait {}
177impl ast::VisibilityOwner for TraitDef {} 178impl ast::VisibilityOwner for Trait {}
178impl ast::GenericParamsOwner for TraitDef {} 179impl ast::GenericParamsOwner for Trait {}
179impl ast::TypeBoundsOwner for TraitDef {} 180impl ast::TypeBoundsOwner for Trait {}
180impl TraitDef { 181impl Trait {
181 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } 182 pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) }
182 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } 183 pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
183 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } 184 pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
@@ -1278,12 +1279,12 @@ pub enum Item {
1278 ExternBlock(ExternBlock), 1279 ExternBlock(ExternBlock),
1279 ExternCrate(ExternCrate), 1280 ExternCrate(ExternCrate),
1280 Fn(Fn), 1281 Fn(Fn),
1281 ImplDef(ImplDef), 1282 Impl(Impl),
1282 MacroCall(MacroCall), 1283 MacroCall(MacroCall),
1283 Module(Module), 1284 Module(Module),
1284 Static(Static), 1285 Static(Static),
1285 Struct(Struct), 1286 Struct(Struct),
1286 TraitDef(TraitDef), 1287 Trait(Trait),
1287 TypeAlias(TypeAlias), 1288 TypeAlias(TypeAlias),
1288 Union(Union), 1289 Union(Union),
1289 Use(Use), 1290 Use(Use),
@@ -1477,8 +1478,8 @@ impl AstNode for Fn {
1477 } 1478 }
1478 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1479 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1479} 1480}
1480impl AstNode for ImplDef { 1481impl AstNode for Impl {
1481 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } 1482 fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL }
1482 fn cast(syntax: SyntaxNode) -> Option<Self> { 1483 fn cast(syntax: SyntaxNode) -> Option<Self> {
1483 if Self::can_cast(syntax.kind()) { 1484 if Self::can_cast(syntax.kind()) {
1484 Some(Self { syntax }) 1485 Some(Self { syntax })
@@ -1532,8 +1533,8 @@ impl AstNode for Struct {
1532 } 1533 }
1533 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1534 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1534} 1535}
1535impl AstNode for TraitDef { 1536impl AstNode for Trait {
1536 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } 1537 fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT }
1537 fn cast(syntax: SyntaxNode) -> Option<Self> { 1538 fn cast(syntax: SyntaxNode) -> Option<Self> {
1538 if Self::can_cast(syntax.kind()) { 1539 if Self::can_cast(syntax.kind()) {
1539 Some(Self { syntax }) 1540 Some(Self { syntax })
@@ -2790,8 +2791,8 @@ impl From<ExternCrate> for Item {
2790impl From<Fn> for Item { 2791impl From<Fn> for Item {
2791 fn from(node: Fn) -> Item { Item::Fn(node) } 2792 fn from(node: Fn) -> Item { Item::Fn(node) }
2792} 2793}
2793impl From<ImplDef> for Item { 2794impl From<Impl> for Item {
2794 fn from(node: ImplDef) -> Item { Item::ImplDef(node) } 2795 fn from(node: Impl) -> Item { Item::Impl(node) }
2795} 2796}
2796impl From<MacroCall> for Item { 2797impl From<MacroCall> for Item {
2797 fn from(node: MacroCall) -> Item { Item::MacroCall(node) } 2798 fn from(node: MacroCall) -> Item { Item::MacroCall(node) }
@@ -2805,8 +2806,8 @@ impl From<Static> for Item {
2805impl From<Struct> for Item { 2806impl From<Struct> for Item {
2806 fn from(node: Struct) -> Item { Item::Struct(node) } 2807 fn from(node: Struct) -> Item { Item::Struct(node) }
2807} 2808}
2808impl From<TraitDef> for Item { 2809impl From<Trait> for Item {
2809 fn from(node: TraitDef) -> Item { Item::TraitDef(node) } 2810 fn from(node: Trait) -> Item { Item::Trait(node) }
2810} 2811}
2811impl From<TypeAlias> for Item { 2812impl From<TypeAlias> for Item {
2812 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } 2813 fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) }
@@ -2820,8 +2821,8 @@ impl From<Use> for Item {
2820impl AstNode for Item { 2821impl AstNode for Item {
2821 fn can_cast(kind: SyntaxKind) -> bool { 2822 fn can_cast(kind: SyntaxKind) -> bool {
2822 match kind { 2823 match kind {
2823 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE 2824 CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE
2824 | STATIC | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, 2825 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
2825 _ => false, 2826 _ => false,
2826 } 2827 }
2827 } 2828 }
@@ -2832,12 +2833,12 @@ impl AstNode for Item {
2832 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), 2833 EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }),
2833 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), 2834 EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }),
2834 FN => Item::Fn(Fn { syntax }), 2835 FN => Item::Fn(Fn { syntax }),
2835 IMPL_DEF => Item::ImplDef(ImplDef { syntax }), 2836 IMPL => Item::Impl(Impl { syntax }),
2836 MACRO_CALL => Item::MacroCall(MacroCall { syntax }), 2837 MACRO_CALL => Item::MacroCall(MacroCall { syntax }),
2837 MODULE => Item::Module(Module { syntax }), 2838 MODULE => Item::Module(Module { syntax }),
2838 STATIC => Item::Static(Static { syntax }), 2839 STATIC => Item::Static(Static { syntax }),
2839 STRUCT => Item::Struct(Struct { syntax }), 2840 STRUCT => Item::Struct(Struct { syntax }),
2840 TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), 2841 TRAIT => Item::Trait(Trait { syntax }),
2841 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), 2842 TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }),
2842 UNION => Item::Union(Union { syntax }), 2843 UNION => Item::Union(Union { syntax }),
2843 USE => Item::Use(Use { syntax }), 2844 USE => Item::Use(Use { syntax }),
@@ -2852,12 +2853,12 @@ impl AstNode for Item {
2852 Item::ExternBlock(it) => &it.syntax, 2853 Item::ExternBlock(it) => &it.syntax,
2853 Item::ExternCrate(it) => &it.syntax, 2854 Item::ExternCrate(it) => &it.syntax,
2854 Item::Fn(it) => &it.syntax, 2855 Item::Fn(it) => &it.syntax,
2855 Item::ImplDef(it) => &it.syntax, 2856 Item::Impl(it) => &it.syntax,
2856 Item::MacroCall(it) => &it.syntax, 2857 Item::MacroCall(it) => &it.syntax,
2857 Item::Module(it) => &it.syntax, 2858 Item::Module(it) => &it.syntax,
2858 Item::Static(it) => &it.syntax, 2859 Item::Static(it) => &it.syntax,
2859 Item::Struct(it) => &it.syntax, 2860 Item::Struct(it) => &it.syntax,
2860 Item::TraitDef(it) => &it.syntax, 2861 Item::Trait(it) => &it.syntax,
2861 Item::TypeAlias(it) => &it.syntax, 2862 Item::TypeAlias(it) => &it.syntax,
2862 Item::Union(it) => &it.syntax, 2863 Item::Union(it) => &it.syntax,
2863 Item::Use(it) => &it.syntax, 2864 Item::Use(it) => &it.syntax,
@@ -3491,7 +3492,7 @@ impl std::fmt::Display for Fn {
3491 std::fmt::Display::fmt(self.syntax(), f) 3492 std::fmt::Display::fmt(self.syntax(), f)
3492 } 3493 }
3493} 3494}
3494impl std::fmt::Display for ImplDef { 3495impl std::fmt::Display for Impl {
3495 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3496 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3496 std::fmt::Display::fmt(self.syntax(), f) 3497 std::fmt::Display::fmt(self.syntax(), f)
3497 } 3498 }
@@ -3516,7 +3517,7 @@ impl std::fmt::Display for Struct {
3516 std::fmt::Display::fmt(self.syntax(), f) 3517 std::fmt::Display::fmt(self.syntax(), f)
3517 } 3518 }
3518} 3519}
3519impl std::fmt::Display for TraitDef { 3520impl std::fmt::Display for Trait {
3520 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3521 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3521 std::fmt::Display::fmt(self.syntax(), f) 3522 std::fmt::Display::fmt(self.syntax(), f)
3522 } 3523 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 4da1d5c11..313f52226 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -141,7 +141,7 @@ impl ast::UseTreeList {
141 } 141 }
142} 142}
143 143
144impl ast::ImplDef { 144impl ast::Impl {
145 pub fn target_type(&self) -> Option<ast::TypeRef> { 145 pub fn target_type(&self) -> Option<ast::TypeRef> {
146 match self.target() { 146 match self.target() {
147 (Some(t), None) | (_, Some(t)) => Some(t), 147 (Some(t), None) | (_, Some(t)) => Some(t),
@@ -481,10 +481,10 @@ impl ast::DocCommentsOwner for ast::RecordField {}
481impl ast::DocCommentsOwner for ast::TupleField {} 481impl ast::DocCommentsOwner for ast::TupleField {}
482impl ast::DocCommentsOwner for ast::Enum {} 482impl ast::DocCommentsOwner for ast::Enum {}
483impl ast::DocCommentsOwner for ast::Variant {} 483impl ast::DocCommentsOwner for ast::Variant {}
484impl ast::DocCommentsOwner for ast::TraitDef {} 484impl ast::DocCommentsOwner for ast::Trait {}
485impl ast::DocCommentsOwner for ast::Module {} 485impl ast::DocCommentsOwner for ast::Module {}
486impl ast::DocCommentsOwner for ast::Static {} 486impl ast::DocCommentsOwner for ast::Static {}
487impl ast::DocCommentsOwner for ast::Const {} 487impl ast::DocCommentsOwner for ast::Const {}
488impl ast::DocCommentsOwner for ast::TypeAlias {} 488impl ast::DocCommentsOwner for ast::TypeAlias {}
489impl ast::DocCommentsOwner for ast::ImplDef {} 489impl ast::DocCommentsOwner for ast::Impl {}
490impl ast::DocCommentsOwner for ast::MacroCall {} 490impl ast::DocCommentsOwner for ast::MacroCall {}
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index 95581a84b..6d1828d20 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -146,7 +146,7 @@ fn n_attached_trivias<'a>(
146 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, 146 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
147) -> usize { 147) -> usize {
148 match kind { 148 match kind {
149 MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF | MODULE 149 MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE
150 | RECORD_FIELD | STATIC => { 150 | RECORD_FIELD | STATIC => {
151 let mut res = 0; 151 let mut res = 0;
152 let mut trivias = trivias.enumerate().peekable(); 152 let mut trivias = trivias.enumerate().peekable();
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs
index a666b18db..0325ab0b4 100644
--- a/crates/ra_syntax/src/validation.rs
+++ b/crates/ra_syntax/src/validation.rs
@@ -204,7 +204,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
204 _ => return, 204 _ => return,
205 } 205 }
206 206
207 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplDef::cast) { 207 let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::Impl::cast) {
208 Some(it) => it, 208 Some(it) => it,
209 None => return, 209 None => return,
210 }; 210 };
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
index 1ce5f188f..bc95b8512 100644
--- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
+++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..182 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
index 02339d035..71fb19783 100644
--- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
+++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast
@@ -75,7 +75,7 @@ [email protected]
75 [email protected] 75 [email protected]
76 [email protected] "," 76 [email protected] ","
77 [email protected] " " 77 [email protected] " "
78 IMPL_DEF@56..60 78 [email protected]
79 [email protected] "impl" 79 [email protected] "impl"
80 [email protected] 80 [email protected]
81 [email protected] 81 [email protected]
@@ -133,7 +133,7 @@ [email protected]
133 [email protected] 133 [email protected]
134 [email protected] "," 134 [email protected] ","
135 [email protected] " " 135 [email protected] " "
136 TRAIT_DEF@98..104 136 [email protected]
137 [email protected] "trait" 137 [email protected] "trait"
138 [email protected] 138 [email protected]
139 [email protected] "," 139 [email protected] ","
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
index 8c8bf7b7e..7e4b11c27 100644
--- a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
+++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..14 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] 4 [email protected]
5 [email protected] "<" 5 [email protected] "<"
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] "Clone" 17 [email protected] "Clone"
18 [email protected] ">" 18 [email protected] ">"
19 [email protected] "\n" 19 [email protected] "\n"
20 IMPL_DEF@15..37 20 [email protected]
21 [email protected] "impl" 21 [email protected] "impl"
22 [email protected] 22 [email protected]
23 [email protected] "<" 23 [email protected] "<"
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
index b1400aa5f..faf87d6e5 100644
--- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
+++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..117 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast b/crates/ra_syntax/test_data/parser/err/0043_default_const.rast
index f041fa6f7..51ad2a846 100644
--- a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast
+++ b/crates/ra_syntax/test_data/parser/err/0043_default_const.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..38 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
index 8b0a888fd..a4271fc87 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast
@@ -17,7 +17,7 @@ [email protected]
17 [email protected] "\'loop" 17 [email protected] "\'loop"
18 [email protected] ":" 18 [email protected] ":"
19 [email protected] " " 19 [email protected] " "
20 IMPL_DEF@23..27 20 [email protected]
21 [email protected] "impl" 21 [email protected] "impl"
22 [email protected] "\n" 22 [email protected] "\n"
23 [email protected] "}" 23 [email protected] "}"
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast
index 2d0253aa0..29d6b3974 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..12 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
@@ -12,7 +12,7 @@ [email protected]
12 [email protected] "{" 12 [email protected] "{"
13 [email protected] "}" 13 [email protected] "}"
14 [email protected] "\n" 14 [email protected] "\n"
15 IMPL_DEF@13..33 15 [email protected]
16 [email protected] "impl" 16 [email protected] "impl"
17 [email protected] " " 17 [email protected] " "
18 [email protected] 18 [email protected]
@@ -33,10 +33,10 @@ [email protected]
33 [email protected] "{" 33 [email protected] "{"
34 [email protected] "}" 34 [email protected] "}"
35 [email protected] "\n" 35 [email protected] "\n"
36 IMPL_DEF@34..38 36 [email protected]
37 [email protected] "impl" 37 [email protected] "impl"
38 [email protected] " " 38 [email protected] " "
39 IMPL_DEF@39..54 39 [email protected]
40 [email protected] "impl" 40 [email protected] "impl"
41 [email protected] " " 41 [email protected] " "
42 [email protected] 42 [email protected]
@@ -49,7 +49,7 @@ [email protected]
49 [email protected] "{" 49 [email protected] "{"
50 [email protected] "}" 50 [email protected] "}"
51 [email protected] "\n" 51 [email protected] "\n"
52 IMPL_DEF@55..70 52 [email protected]
53 [email protected] "impl" 53 [email protected] "impl"
54 [email protected] " " 54 [email protected] " "
55 [email protected] 55 [email protected]
@@ -60,7 +60,7 @@ [email protected]
60 [email protected] " " 60 [email protected] " "
61 [email protected] "for" 61 [email protected] "for"
62 [email protected] " " 62 [email protected] " "
63 IMPL_DEF@71..86 63 [email protected]
64 [email protected] "impl" 64 [email protected] "impl"
65 [email protected] " " 65 [email protected] " "
66 [email protected] 66 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
index 22c7c5f0d..acd72094b 100644
--- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..61 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
index 955e00dde..c7289e400 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..82 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast
index 87c170707..ae61cbad8 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..127 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast
index 69b82e33c..625ab4c2d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..17 2 [email protected]
3 [email protected] "unsafe" 3 [email protected] "unsafe"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "trait" 5 [email protected] "trait"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
index e75180900..20b2b6c19 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..68 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
index 52181ca0c..ca0702aba 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..88 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast
index 8f20ccaa3..3638462f8 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..41 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
@@ -52,7 +52,7 @@ [email protected]
52 [email protected] "{" 52 [email protected] "{"
53 [email protected] "}" 53 [email protected] "}"
54 [email protected] "\n" 54 [email protected] "\n"
55 TRAIT_DEF@42..100 55 [email protected]
56 [email protected] "trait" 56 [email protected] "trait"
57 [email protected] " " 57 [email protected] " "
58 [email protected] 58 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast
index 8a6b5a8fc..d6dfa83b7 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..26 2 [email protected]
3 [email protected] "unsafe" 3 [email protected] "unsafe"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "default" 5 [email protected] "default"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
index 02c57079f..a5bf55131 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..21 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
index 31178f86e..4368930cc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..19 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "!" 5 [email protected] "!"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast
index 26825ef86..209711fc4 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..11 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast
index e3223cee5..43c09affe 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..18 2 [email protected]
3 [email protected] "unsafe" 3 [email protected] "unsafe"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "impl" 5 [email protected] "impl"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast
index 7efa4c34d..0cac9ac43 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..15 2 [email protected]
3 [email protected] "auto" 3 [email protected] "auto"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "trait" 5 [email protected] "trait"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast
index fad27be66..0ef11c682 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..22 2 [email protected]
3 [email protected] "unsafe" 3 [email protected] "unsafe"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "auto" 5 [email protected] "auto"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast
index 8a839a4a6..0a1b21d6e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..19 2 [email protected]
3 [email protected] "default" 3 [email protected] "default"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "impl" 5 [email protected] "impl"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
index f2561abd6..141a7b203 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -8,7 +8,7 @@ [email protected]
8 [email protected] "{" 8 [email protected] "{"
9 [email protected] "}" 9 [email protected] "}"
10 [email protected] "\n" 10 [email protected] "\n"
11 IMPL_DEF@9..93 11 [email protected]
12 [email protected] "impl" 12 [email protected] "impl"
13 [email protected] " " 13 [email protected] " "
14 [email protected] 14 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
index de02238df..b8d26a53a 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..68 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
index 07e555d63..8f197a19d 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..28 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] 4 [email protected]
5 [email protected] "<" 5 [email protected] "<"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
index e2a770a37..cc220e534 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..18 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
@@ -31,7 +31,7 @@ [email protected]
31 [email protected] ">" 31 [email protected] ">"
32 [email protected] ";" 32 [email protected] ";"
33 [email protected] "\n" 33 [email protected] "\n"
34 TRAIT_DEF@19..51 34 [email protected]
35 [email protected] "trait" 35 [email protected] "trait"
36 [email protected] " " 36 [email protected] " "
37 [email protected] 37 [email protected]
@@ -82,7 +82,7 @@ [email protected]
82 [email protected] "Copy" 82 [email protected] "Copy"
83 [email protected] ";" 83 [email protected] ";"
84 [email protected] "\n" 84 [email protected] "\n"
85 TRAIT_DEF@52..82 85 [email protected]
86 [email protected] "trait" 86 [email protected] "trait"
87 [email protected] " " 87 [email protected] " "
88 [email protected] 88 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast
index 680f35445..1269621dc 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..49 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast
index e0c338297..6bfe925af 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..26 2 [email protected]
3 [email protected] "default" 3 [email protected] "default"
4 [email protected] " " 4 [email protected] " "
5 [email protected] "unsafe" 5 [email protected] "unsafe"
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast
index 4bcf07ffb..280d4cb82 100644
--- a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..36 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
@@ -20,7 +20,7 @@ [email protected]
20 [email protected] "\n" 20 [email protected] "\n"
21 [email protected] "}" 21 [email protected] "}"
22 [email protected] "\n\n" 22 [email protected] "\n\n"
23 TRAIT_DEF@38..95 23 [email protected]
24 [email protected] "trait" 24 [email protected] "trait"
25 [email protected] " " 25 [email protected] " "
26 [email protected] 26 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast
index c4ffc0a3d..ed29b0812 100644
--- a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast
@@ -8,7 +8,7 @@ [email protected]
8 [email protected] "Foo" 8 [email protected] "Foo"
9 [email protected] ";" 9 [email protected] ";"
10 [email protected] "\n\n" 10 [email protected] "\n\n"
11 IMPL_DEF@75..141 11 [email protected]
12 [email protected] "impl" 12 [email protected] "impl"
13 [email protected] " " 13 [email protected] " "
14 [email protected] 14 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
index 5ebc53618..139ce9046 100644
--- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast
@@ -89,7 +89,7 @@ [email protected]
89 [email protected] "\n\n" 89 [email protected] "\n\n"
90 [email protected] "// https://github.com ..." 90 [email protected] "// https://github.com ..."
91 [email protected] "\n" 91 [email protected] "\n"
92 IMPL_DEF@524..685 92 [email protected]
93 [email protected] "impl" 93 [email protected] "impl"
94 [email protected] " " 94 [email protected] " "
95 [email protected] 95 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
index 8081eefbc..2cc849784 100644
--- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast
@@ -186,7 +186,7 @@ [email protected]
186 [email protected] "{" 186 [email protected] "{"
187 [email protected] "}" 187 [email protected] "}"
188 [email protected] "\n\n" 188 [email protected] "\n\n"
189 TRAIT_DEF@174..236 189 [email protected]
190 [email protected] "trait" 190 [email protected] "trait"
191 [email protected] " " 191 [email protected] " "
192 [email protected] 192 [email protected]
@@ -251,7 +251,7 @@ [email protected]
251 [email protected] "\n" 251 [email protected] "\n"
252 [email protected] "}" 252 [email protected] "}"
253 [email protected] "\n\n" 253 [email protected] "\n\n"
254 IMPL_DEF@238..519 254 [email protected]
255 [email protected] "impl" 255 [email protected] "impl"
256 [email protected] " " 256 [email protected] " "
257 [email protected] 257 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
index a87bbf4eb..facce8167 100644
--- a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 TRAIT_DEF@0..169 2 [email protected]
3 [email protected] "trait" 3 [email protected] "trait"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
index ef0eca47c..453757c3c 100644
--- a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..136 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast
index 485efe20c..6246a31a6 100644
--- a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast
@@ -1,5 +1,5 @@
1[email protected] 1[email protected]
2 IMPL_DEF@0..45 2 [email protected]
3 [email protected] "impl" 3 [email protected] "impl"
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index df4969b80..62ed6880b 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -924,7 +924,7 @@ pub(crate) fn handle_code_lens(
924 .filter(|it| { 924 .filter(|it| {
925 matches!( 925 matches!(
926 it.kind, 926 it.kind,
927 SyntaxKind::TRAIT_DEF 927 SyntaxKind::TRAIT
928 | SyntaxKind::STRUCT 928 | SyntaxKind::STRUCT
929 | SyntaxKind::ENUM 929 | SyntaxKind::ENUM
930 | SyntaxKind::UNION 930 | SyntaxKind::UNION
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index fd5123301..fadcc5853 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -35,14 +35,14 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
35 SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, 35 SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct,
36 SyntaxKind::ENUM => lsp_types::SymbolKind::Enum, 36 SyntaxKind::ENUM => lsp_types::SymbolKind::Enum,
37 SyntaxKind::VARIANT => lsp_types::SymbolKind::EnumMember, 37 SyntaxKind::VARIANT => lsp_types::SymbolKind::EnumMember,
38 SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, 38 SyntaxKind::TRAIT => lsp_types::SymbolKind::Interface,
39 SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, 39 SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
40 SyntaxKind::MODULE => lsp_types::SymbolKind::Module, 40 SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
41 SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, 41 SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter,
42 SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, 42 SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field,
43 SyntaxKind::STATIC => lsp_types::SymbolKind::Constant, 43 SyntaxKind::STATIC => lsp_types::SymbolKind::Constant,
44 SyntaxKind::CONST => lsp_types::SymbolKind::Constant, 44 SyntaxKind::CONST => lsp_types::SymbolKind::Constant,
45 SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, 45 SyntaxKind::IMPL => lsp_types::SymbolKind::Object,
46 _ => lsp_types::SymbolKind::Variable, 46 _ => lsp_types::SymbolKind::Variable,
47 } 47 }
48} 48}