diff options
author | Aleksey Kladov <[email protected]> | 2020-07-30 17:17:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-07-30 17:17:28 +0100 |
commit | c83467796b6c7365ea4f41900d74444384a9e618 (patch) | |
tree | 6eb770e4c9751813cc0530e7c645fed8914eed12 | |
parent | b2cdb0b22631a66a00be25ba4b2e9c0b34ff426a (diff) |
Finalize Trait grammar
42 files changed, 92 insertions, 92 deletions
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 @@ | |||
1 | use ra_syntax::{ | 1 | use 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 | }; |
7 | use test_utils::mark; | 7 | use 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/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 84ac75fa8..fd1d87423 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs | |||
@@ -38,7 +38,7 @@ 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::ImplDef(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) => { |
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 9581552e5..057f6e32f 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 | } |
101 | impl HasSource for Trait { | 101 | impl 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 | } |
@@ -127,7 +127,7 @@ impl HasSource for ImplDef { | |||
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl 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..5f5104dab 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -583,7 +583,7 @@ 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::ImplDef, 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), |
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 782a03f9e..ae41d3ddf 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -65,7 +65,7 @@ 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::ImplDef>) -> Option<ImplId> { |
@@ -154,7 +154,7 @@ 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 | }, |
@@ -207,7 +207,7 @@ 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::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), |
213 | _ => continue, | 213 | _ => continue, |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 4a26e6397..0d0242173 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -664,7 +664,7 @@ 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 | } |
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 | ||
69 | type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::TraitDef, ast::TypeParam>>; | 69 | type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::Trait, ast::TypeParam>>; |
70 | 70 | ||
71 | impl GenericParams { | 71 | impl GenericParams { |
72 | pub(crate) fn generic_params_query( | 72 | pub(crate) fn generic_params_query( |
@@ -317,7 +317,7 @@ impl GenericParams { | |||
317 | 317 | ||
318 | impl HasChildSource for GenericDefId { | 318 | impl 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..11002b1ad 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -419,7 +419,7 @@ 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::ImplDef, |
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, |
@@ -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)] |
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index a94548e5d..aaf3cfd3a 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -95,7 +95,7 @@ impl Ctx { | |||
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::ImplDef(_) | 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,7 +111,7 @@ 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::ImplDef(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<_>>(), |
@@ -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 = |
@@ -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..40a9bd53d 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 }]) }] |
@@ -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 }]) }] |
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index f75e3bb50..0bed08875 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs | |||
@@ -19,7 +19,7 @@ pub const CONST: Key<ast::Const, ConstId> = Key::new(); | |||
19 | pub const STATIC: Key<ast::Static, StaticId> = Key::new(); | 19 | pub const STATIC: Key<ast::Static, StaticId> = Key::new(); |
20 | pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new(); | 20 | pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new(); |
21 | pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); | 21 | pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); |
22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); | 22 | pub const TRAIT: Key<ast::Trait, TraitId> = Key::new(); |
23 | pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); | 23 | pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); |
24 | pub const UNION: Key<ast::Union, UnionId> = Key::new(); | 24 | pub const UNION: Key<ast::Union, UnionId> = Key::new(); |
25 | pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); | 25 | pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); |
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index b8408da4e..6c11f5830 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] |
@@ -113,7 +113,7 @@ fn test_if_is_prev() { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { | 115 | pub(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] |
119 | fn test_has_trait_as_prev_sibling() { | 119 | fn test_has_trait_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 | ||
34 | impl ShortLabel for ast::TraitDef { | 34 | impl 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..3fc972460 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(); |
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 | ||
63 | fn impls_for_trait( | 63 | fn 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/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 19ec73d2a..a66453c04 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -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 | ||
346 | fn is_type(kind: SyntaxKind) -> bool { | 346 | fn 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..cd4b2381d 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -151,7 +151,7 @@ pub(crate) fn reparser( | |||
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_DEF => 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..5603d61a9 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 |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 64889676e..27eed0090 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -133,7 +133,7 @@ pub enum SyntaxKind { | |||
133 | USE, | 133 | USE, |
134 | STATIC, | 134 | STATIC, |
135 | CONST, | 135 | CONST, |
136 | TRAIT_DEF, | 136 | TRAIT, |
137 | IMPL_DEF, | 137 | IMPL_DEF, |
138 | TYPE_ALIAS, | 138 | TYPE_ALIAS, |
139 | MACRO_CALL, | 139 | MACRO_CALL, |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 00a70fce0..3adb6b2d4 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -169,15 +169,15 @@ impl Struct { | |||
169 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } | 169 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } |
170 | } | 170 | } |
171 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 171 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
172 | pub struct TraitDef { | 172 | pub struct Trait { |
173 | pub(crate) syntax: SyntaxNode, | 173 | pub(crate) syntax: SyntaxNode, |
174 | } | 174 | } |
175 | impl ast::AttrsOwner for TraitDef {} | 175 | impl ast::AttrsOwner for Trait {} |
176 | impl ast::NameOwner for TraitDef {} | 176 | impl ast::NameOwner for Trait {} |
177 | impl ast::VisibilityOwner for TraitDef {} | 177 | impl ast::VisibilityOwner for Trait {} |
178 | impl ast::GenericParamsOwner for TraitDef {} | 178 | impl ast::GenericParamsOwner for Trait {} |
179 | impl ast::TypeBoundsOwner for TraitDef {} | 179 | impl ast::TypeBoundsOwner for Trait {} |
180 | impl TraitDef { | 180 | impl Trait { |
181 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 181 | 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]) } | 182 | 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]) } | 183 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } |
@@ -1283,7 +1283,7 @@ pub enum Item { | |||
1283 | Module(Module), | 1283 | Module(Module), |
1284 | Static(Static), | 1284 | Static(Static), |
1285 | Struct(Struct), | 1285 | Struct(Struct), |
1286 | TraitDef(TraitDef), | 1286 | Trait(Trait), |
1287 | TypeAlias(TypeAlias), | 1287 | TypeAlias(TypeAlias), |
1288 | Union(Union), | 1288 | Union(Union), |
1289 | Use(Use), | 1289 | Use(Use), |
@@ -1532,8 +1532,8 @@ impl AstNode for Struct { | |||
1532 | } | 1532 | } |
1533 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1533 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1534 | } | 1534 | } |
1535 | impl AstNode for TraitDef { | 1535 | impl AstNode for Trait { |
1536 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } | 1536 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } |
1537 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1537 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1538 | if Self::can_cast(syntax.kind()) { | 1538 | if Self::can_cast(syntax.kind()) { |
1539 | Some(Self { syntax }) | 1539 | Some(Self { syntax }) |
@@ -2805,8 +2805,8 @@ impl From<Static> for Item { | |||
2805 | impl From<Struct> for Item { | 2805 | impl From<Struct> for Item { |
2806 | fn from(node: Struct) -> Item { Item::Struct(node) } | 2806 | fn from(node: Struct) -> Item { Item::Struct(node) } |
2807 | } | 2807 | } |
2808 | impl From<TraitDef> for Item { | 2808 | impl From<Trait> for Item { |
2809 | fn from(node: TraitDef) -> Item { Item::TraitDef(node) } | 2809 | fn from(node: Trait) -> Item { Item::Trait(node) } |
2810 | } | 2810 | } |
2811 | impl From<TypeAlias> for Item { | 2811 | impl From<TypeAlias> for Item { |
2812 | fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } | 2812 | fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } |
@@ -2821,7 +2821,7 @@ impl AstNode for Item { | |||
2821 | fn can_cast(kind: SyntaxKind) -> bool { | 2821 | fn can_cast(kind: SyntaxKind) -> bool { |
2822 | match kind { | 2822 | match kind { |
2823 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE | 2823 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE |
2824 | | STATIC | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, | 2824 | | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true, |
2825 | _ => false, | 2825 | _ => false, |
2826 | } | 2826 | } |
2827 | } | 2827 | } |
@@ -2837,7 +2837,7 @@ impl AstNode for Item { | |||
2837 | MODULE => Item::Module(Module { syntax }), | 2837 | MODULE => Item::Module(Module { syntax }), |
2838 | STATIC => Item::Static(Static { syntax }), | 2838 | STATIC => Item::Static(Static { syntax }), |
2839 | STRUCT => Item::Struct(Struct { syntax }), | 2839 | STRUCT => Item::Struct(Struct { syntax }), |
2840 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), | 2840 | TRAIT => Item::Trait(Trait { syntax }), |
2841 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), | 2841 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), |
2842 | UNION => Item::Union(Union { syntax }), | 2842 | UNION => Item::Union(Union { syntax }), |
2843 | USE => Item::Use(Use { syntax }), | 2843 | USE => Item::Use(Use { syntax }), |
@@ -2857,7 +2857,7 @@ impl AstNode for Item { | |||
2857 | Item::Module(it) => &it.syntax, | 2857 | Item::Module(it) => &it.syntax, |
2858 | Item::Static(it) => &it.syntax, | 2858 | Item::Static(it) => &it.syntax, |
2859 | Item::Struct(it) => &it.syntax, | 2859 | Item::Struct(it) => &it.syntax, |
2860 | Item::TraitDef(it) => &it.syntax, | 2860 | Item::Trait(it) => &it.syntax, |
2861 | Item::TypeAlias(it) => &it.syntax, | 2861 | Item::TypeAlias(it) => &it.syntax, |
2862 | Item::Union(it) => &it.syntax, | 2862 | Item::Union(it) => &it.syntax, |
2863 | Item::Use(it) => &it.syntax, | 2863 | Item::Use(it) => &it.syntax, |
@@ -3516,7 +3516,7 @@ impl std::fmt::Display for Struct { | |||
3516 | std::fmt::Display::fmt(self.syntax(), f) | 3516 | std::fmt::Display::fmt(self.syntax(), f) |
3517 | } | 3517 | } |
3518 | } | 3518 | } |
3519 | impl std::fmt::Display for TraitDef { | 3519 | impl std::fmt::Display for Trait { |
3520 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3520 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3521 | std::fmt::Display::fmt(self.syntax(), f) | 3521 | std::fmt::Display::fmt(self.syntax(), f) |
3522 | } | 3522 | } |
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 4da1d5c11..a8d8955de 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -481,7 +481,7 @@ impl ast::DocCommentsOwner for ast::RecordField {} | |||
481 | impl ast::DocCommentsOwner for ast::TupleField {} | 481 | impl ast::DocCommentsOwner for ast::TupleField {} |
482 | impl ast::DocCommentsOwner for ast::Enum {} | 482 | impl ast::DocCommentsOwner for ast::Enum {} |
483 | impl ast::DocCommentsOwner for ast::Variant {} | 483 | impl ast::DocCommentsOwner for ast::Variant {} |
484 | impl ast::DocCommentsOwner for ast::TraitDef {} | 484 | impl ast::DocCommentsOwner for ast::Trait {} |
485 | impl ast::DocCommentsOwner for ast::Module {} | 485 | impl ast::DocCommentsOwner for ast::Module {} |
486 | impl ast::DocCommentsOwner for ast::Static {} | 486 | impl ast::DocCommentsOwner for ast::Static {} |
487 | impl ast::DocCommentsOwner for ast::Const {} | 487 | impl ast::DocCommentsOwner for ast::Const {} |
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/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast index 02339d035..a6e304b78 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 | |||
@@ -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/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/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/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/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/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/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/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/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/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast index 8081eefbc..7a574ebb4 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] |
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/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..3889ebed1 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -35,7 +35,7 @@ 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, |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 56e3f4b0a..ea8bf50ed 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -103,7 +103,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
103 | "USE", | 103 | "USE", |
104 | "STATIC", | 104 | "STATIC", |
105 | "CONST", | 105 | "CONST", |
106 | "TRAIT_DEF", | 106 | "TRAIT", |
107 | "IMPL_DEF", | 107 | "IMPL_DEF", |
108 | "TYPE_ALIAS", | 108 | "TYPE_ALIAS", |
109 | "MACRO_CALL", | 109 | "MACRO_CALL", |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 4f7f6403e..b30658397 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -14,7 +14,7 @@ Item = | |||
14 | | Module | 14 | | Module |
15 | | Static | 15 | | Static |
16 | | Struct | 16 | | Struct |
17 | | TraitDef | 17 | | Trait |
18 | | TypeAlias | 18 | | TypeAlias |
19 | | Union | 19 | | Union |
20 | | Use | 20 | | Use |
@@ -123,7 +123,7 @@ Static = | |||
123 | Attr* Visibility? 'static'? 'mut'? Name ':' ascribed_type:TypeRef | 123 | Attr* Visibility? 'static'? 'mut'? Name ':' ascribed_type:TypeRef |
124 | '=' body:Expr ';' | 124 | '=' body:Expr ';' |
125 | 125 | ||
126 | TraitDef = | 126 | Trait = |
127 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList | 127 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList |
128 | (':' TypeBoundList?)? WhereClause | 128 | (':' TypeBoundList?)? WhereClause |
129 | AssocItemList | 129 | AssocItemList |