aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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/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.rs2
-rw-r--r--crates/ra_assists/src/utils.rs4
-rw-r--r--crates/ra_hir/src/has_source.rs4
-rw-r--r--crates/ra_hir/src/semantics.rs2
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs6
-rw-r--r--crates/ra_hir_def/src/body/lower.rs2
-rw-r--r--crates/ra_hir_def/src/item_tree.rs4
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs6
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs6
-rw-r--r--crates/ra_hir_def/src/keys.rs2
-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.rs4
-rw-r--r--crates/ra_ide/src/file_structure.rs6
-rw-r--r--crates/ra_ide/src/references/rename.rs5
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs2
-rw-r--r--crates/ra_parser/src/grammar.rs2
-rw-r--r--crates/ra_parser/src/grammar/items.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs31
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs4
-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.rast2
-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/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/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/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/0047_unsafe_default_impl.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/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/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/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.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/to_proto.rs2
-rw-r--r--xtask/src/ast_src.rs2
-rw-r--r--xtask/src/codegen/rust.ungram11
54 files changed, 103 insertions, 100 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/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 fd1d87423..6d394443e 100644
--- a/crates/ra_assists/src/handlers/move_bounds.rs
+++ b/crates/ra_assists/src/handlers/move_bounds.rs
@@ -39,7 +39,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
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::Trait(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 057f6e32f..1c691d961 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -120,8 +120,8 @@ 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}
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs
index 5f5104dab..6f3b3dc9a 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -584,7 +584,7 @@ to_def_impls![
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::Trait, 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 ae41d3ddf..d1994e2e7 100644
--- a/crates/ra_hir/src/semantics/source_to_def.rs
+++ b/crates/ra_hir/src/semantics/source_to_def.rs
@@ -68,7 +68,7 @@ impl SourceToDefCtx<'_, '_> {
68 pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> 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> {
@@ -158,7 +158,7 @@ impl SourceToDefCtx<'_, '_> {
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 },
@@ -209,7 +209,7 @@ impl SourceToDefCtx<'_, '_> {
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::Trait(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 0d0242173..78f6da5b8 100644
--- a/crates/ra_hir_def/src/body/lower.rs
+++ b/crates/ra_hir_def/src/body/lower.rs
@@ -669,7 +669,7 @@ impl ExprCollector<'_> {
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/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs
index 11002b1ad..63b56405c 100644
--- a/crates/ra_hir_def/src/item_tree.rs
+++ b/crates/ra_hir_def/src/item_tree.rs
@@ -420,7 +420,7 @@ mod_items! {
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::Trait, 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,
@@ -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 aaf3cfd3a..b0cf94956 100644
--- a/crates/ra_hir_def/src/item_tree/lower.rs
+++ b/crates/ra_hir_def/src/item_tree/lower.rs
@@ -95,7 +95,7 @@ impl Ctx {
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::Trait(_) | 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(_) => {}
@@ -112,7 +112,7 @@ impl Ctx {
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::Trait(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 )),
@@ -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));
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs
index 40a9bd53d..a81497fa8 100644
--- a/crates/ra_hir_def/src/item_tree/tests.rs
+++ b/crates/ra_hir_def/src/item_tree/tests.rs
@@ -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:
@@ -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 0bed08875..441bdbead 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -18,7 +18,7 @@ pub const FUNCTION: Key<ast::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::Trait, 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();
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 6c11f5830..a68861e1c 100644
--- a/crates/ra_ide/src/completion/patterns.rs
+++ b/crates/ra_ide/src/completion/patterns.rs
@@ -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]
@@ -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/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index 3fc972460..7d378f2d0 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -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/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 a66453c04..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}
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs
index cd4b2381d..c2e1d701e 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -150,7 +150,7 @@ 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 => items::trait_item_list, 154 TRAIT => items::trait_item_list,
155 _ => return None, 155 _ => return None,
156 }, 156 },
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 5603d61a9..cca524cea 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -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 27eed0090..d1b22f08a 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -134,7 +134,7 @@ pub enum SyntaxKind {
134 STATIC, 134 STATIC,
135 CONST, 135 CONST,
136 TRAIT, 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 3adb6b2d4..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) }
@@ -1278,7 +1279,7 @@ 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),
@@ -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 })
@@ -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) }
@@ -2820,7 +2821,7 @@ 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 | TYPE_ALIAS | UNION | USE => true, 2825 | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true,
2825 _ => false, 2826 _ => false,
2826 } 2827 }
@@ -2832,7 +2833,7 @@ 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 }),
@@ -2852,7 +2853,7 @@ 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,
@@ -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 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index a8d8955de..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),
@@ -486,5 +486,5 @@ impl 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/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 a6e304b78..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]
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/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/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/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/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/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/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/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/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 7a574ebb4..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
@@ -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/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/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs
index 3889ebed1..fadcc5853 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -42,7 +42,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
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}
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs
index ea8bf50ed..c7087a14e 100644
--- a/xtask/src/ast_src.rs
+++ b/xtask/src/ast_src.rs
@@ -104,7 +104,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
104 "STATIC", 104 "STATIC",
105 "CONST", 105 "CONST",
106 "TRAIT", 106 "TRAIT",
107 "IMPL_DEF", 107 "IMPL",
108 "TYPE_ALIAS", 108 "TYPE_ALIAS",
109 "MACRO_CALL", 109 "MACRO_CALL",
110 "TOKEN_TREE", 110 "TOKEN_TREE",
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram
index b30658397..cda0e8fbb 100644
--- a/xtask/src/codegen/rust.ungram
+++ b/xtask/src/codegen/rust.ungram
@@ -9,7 +9,7 @@ Item =
9| ExternBlock 9| ExternBlock
10| ExternCrate 10| ExternCrate
11| Fn 11| Fn
12| ImplDef 12| Impl
13| MacroCall 13| MacroCall
14| Module 14| Module
15| Static 15| Static
@@ -131,9 +131,12 @@ Trait =
131AssocItemList = 131AssocItemList =
132 '{' AssocItem* '}' 132 '{' AssocItem* '}'
133 133
134ImplDef = 134Impl =
135 Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' GenericParamList? '!'? 'for' 135 Attr* Visibility?
136 WhereClause? 136 'default'? 'unsafe'? 'impl' 'const'? GenericParamList? (
137 TypeRef
138 | '!'? TypeRef 'for' TypeRef
139 ) WhereClause?
137 AssocItemList 140 AssocItemList
138 141
139ParenType = 142ParenType =