diff options
Diffstat (limited to 'crates')
38 files changed, 143 insertions, 157 deletions
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 1e4d4748c..1ab176c26 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -120,7 +120,7 @@ fn add_missing_impl_members_inner( | |||
120 | match item { | 120 | match item { |
121 | ast::AssocItem::Fn(def) => def.name(), | 121 | ast::AssocItem::Fn(def) => def.name(), |
122 | ast::AssocItem::TypeAlias(def) => def.name(), | 122 | ast::AssocItem::TypeAlias(def) => def.name(), |
123 | ast::AssocItem::ConstDef(def) => def.name(), | 123 | ast::AssocItem::Const(def) => def.name(), |
124 | ast::AssocItem::MacroCall(_) => None, | 124 | ast::AssocItem::MacroCall(_) => None, |
125 | } | 125 | } |
126 | .map(|it| it.text().clone()) | 126 | .map(|it| it.text().clone()) |
@@ -131,7 +131,7 @@ fn add_missing_impl_members_inner( | |||
131 | .map(|i| match i { | 131 | .map(|i| match i { |
132 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value), | 132 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value), |
133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value), | 133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value), |
134 | hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value), | 134 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(ctx.db()).value), |
135 | }) | 135 | }) |
136 | .filter(|t| def_name(&t).is_some()) | 136 | .filter(|t| def_name(&t).is_some()) |
137 | .filter(|t| match t { | 137 | .filter(|t| match t { |
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 44f3e8ee3..76144d7d2 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_DEF, ENUM, FN, MODULE, STATIC_DEF, STRUCT, TRAIT_DEF, VISIBILITY}, | 4 | SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT_DEF, 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_DEF, STATIC_DEF, FN, MODULE, STRUCT, ENUM, TRAIT_DEF]; | 39 | let def_kws = vec![CONST, STATIC, FN, MODULE, STRUCT, ENUM, TRAIT_DEF]; |
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/utils.rs b/crates/ra_assists/src/utils.rs index 748be011b..337e3474f 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -78,7 +78,7 @@ pub fn get_missing_assoc_items( | |||
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | ast::AssocItem::ConstDef(c) => { | 81 | ast::AssocItem::Const(c) => { |
82 | if let Some(n) = c.name() { | 82 | if let Some(n) = c.name() { |
83 | impl_fns_consts.insert(n.syntax().to_string()); | 83 | impl_fns_consts.insert(n.syntax().to_string()); |
84 | } | 84 | } |
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 1c5747581..9581552e5 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs | |||
@@ -87,14 +87,14 @@ impl HasSource for Function { | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | impl HasSource for Const { | 89 | impl HasSource for Const { |
90 | type Ast = ast::ConstDef; | 90 | type Ast = ast::Const; |
91 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::ConstDef> { | 91 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Const> { |
92 | self.id.lookup(db.upcast()).source(db.upcast()) | 92 | self.id.lookup(db.upcast()).source(db.upcast()) |
93 | } | 93 | } |
94 | } | 94 | } |
95 | impl HasSource for Static { | 95 | impl HasSource for Static { |
96 | type Ast = ast::StaticDef; | 96 | type Ast = ast::Static; |
97 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::StaticDef> { | 97 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Static> { |
98 | self.id.lookup(db.upcast()).source(db.upcast()) | 98 | self.id.lookup(db.upcast()).source(db.upcast()) |
99 | } | 99 | } |
100 | } | 100 | } |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index e18df2537..32a60b789 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -586,8 +586,8 @@ to_def_impls![ | |||
586 | (crate::Trait, ast::TraitDef, trait_to_def), | 586 | (crate::Trait, ast::TraitDef, 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::ConstDef, const_to_def), | 589 | (crate::Const, ast::Const, const_to_def), |
590 | (crate::Static, ast::StaticDef, static_to_def), | 590 | (crate::Static, ast::Static, static_to_def), |
591 | (crate::Function, ast::Fn, fn_to_def), | 591 | (crate::Function, ast::Fn, fn_to_def), |
592 | (crate::Field, ast::RecordField, record_field_to_def), | 592 | (crate::Field, ast::RecordField, record_field_to_def), |
593 | (crate::Field, ast::TupleField, tuple_field_to_def), | 593 | (crate::Field, ast::TupleField, tuple_field_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 b85a12680..782a03f9e 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -83,10 +83,10 @@ impl SourceToDefCtx<'_, '_> { | |||
83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { | 83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { |
84 | self.to_def(src, keys::UNION) | 84 | self.to_def(src, keys::UNION) |
85 | } | 85 | } |
86 | pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> { | 86 | pub(super) fn static_to_def(&mut self, src: InFile<ast::Static>) -> Option<StaticId> { |
87 | self.to_def(src, keys::STATIC) | 87 | self.to_def(src, keys::STATIC) |
88 | } | 88 | } |
89 | pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> { | 89 | pub(super) fn const_to_def(&mut self, src: InFile<ast::Const>) -> Option<ConstId> { |
90 | self.to_def(src, keys::CONST) | 90 | self.to_def(src, keys::CONST) |
91 | } | 91 | } |
92 | pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { | 92 | pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { |
@@ -178,11 +178,11 @@ impl SourceToDefCtx<'_, '_> { | |||
178 | let def = self.union_to_def(container.with_value(it))?; | 178 | let def = self.union_to_def(container.with_value(it))?; |
179 | VariantId::from(def).into() | 179 | VariantId::from(def).into() |
180 | }, | 180 | }, |
181 | ast::StaticDef(it) => { | 181 | ast::Static(it) => { |
182 | let def = self.static_to_def(container.with_value(it))?; | 182 | let def = self.static_to_def(container.with_value(it))?; |
183 | DefWithBodyId::from(def).into() | 183 | DefWithBodyId::from(def).into() |
184 | }, | 184 | }, |
185 | ast::ConstDef(it) => { | 185 | ast::Const(it) => { |
186 | let def = self.const_to_def(container.with_value(it))?; | 186 | let def = self.const_to_def(container.with_value(it))?; |
187 | DefWithBodyId::from(def).into() | 187 | DefWithBodyId::from(def).into() |
188 | }, | 188 | }, |
@@ -222,8 +222,8 @@ impl SourceToDefCtx<'_, '_> { | |||
222 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { | 222 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { |
223 | let res: DefWithBodyId = match_ast! { | 223 | let res: DefWithBodyId = match_ast! { |
224 | match (container.value) { | 224 | match (container.value) { |
225 | ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(), | 225 | ast::Const(it) => self.const_to_def(container.with_value(it))?.into(), |
226 | ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(), | 226 | ast::Static(it) => self.static_to_def(container.with_value(it))?.into(), |
227 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), | 227 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
228 | _ => continue, | 228 | _ => continue, |
229 | } | 229 | } |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 105299f70..4a26e6397 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -641,14 +641,14 @@ impl ExprCollector<'_> { | |||
641 | def.name(), | 641 | def.name(), |
642 | ) | 642 | ) |
643 | } | 643 | } |
644 | ast::Item::ConstDef(def) => { | 644 | ast::Item::Const(def) => { |
645 | let id = self.find_inner_item(&def)?; | 645 | let id = self.find_inner_item(&def)?; |
646 | ( | 646 | ( |
647 | ConstLoc { container: container.into(), id }.intern(self.db).into(), | 647 | ConstLoc { container: container.into(), id }.intern(self.db).into(), |
648 | def.name(), | 648 | def.name(), |
649 | ) | 649 | ) |
650 | } | 650 | } |
651 | ast::Item::StaticDef(def) => { | 651 | ast::Item::Static(def) => { |
652 | let id = self.find_inner_item(&def)?; | 652 | let id = self.find_inner_item(&def)?; |
653 | (StaticLoc { container, id }.intern(self.db).into(), def.name()) | 653 | (StaticLoc { container, id }.intern(self.db).into(), def.name()) |
654 | } | 654 | } |
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index 24ad41187..c478a9909 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -417,8 +417,8 @@ mod_items! { | |||
417 | Struct in structs -> ast::Struct, | 417 | Struct in structs -> ast::Struct, |
418 | Union in unions -> ast::Union, | 418 | Union in unions -> ast::Union, |
419 | Enum in enums -> ast::Enum, | 419 | Enum in enums -> ast::Enum, |
420 | Const in consts -> ast::ConstDef, | 420 | Const in consts -> ast::Const, |
421 | Static in statics -> ast::StaticDef, | 421 | Static in statics -> ast::Static, |
422 | Trait in traits -> ast::TraitDef, | 422 | Trait in traits -> ast::TraitDef, |
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, |
@@ -552,7 +552,7 @@ pub struct Const { | |||
552 | pub name: Option<Name>, | 552 | pub name: Option<Name>, |
553 | pub visibility: RawVisibilityId, | 553 | pub visibility: RawVisibilityId, |
554 | pub type_ref: TypeRef, | 554 | pub type_ref: TypeRef, |
555 | pub ast_id: FileAstId<ast::ConstDef>, | 555 | pub ast_id: FileAstId<ast::Const>, |
556 | } | 556 | } |
557 | 557 | ||
558 | #[derive(Debug, Clone, Eq, PartialEq)] | 558 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -561,7 +561,7 @@ pub struct Static { | |||
561 | pub visibility: RawVisibilityId, | 561 | pub visibility: RawVisibilityId, |
562 | pub mutable: bool, | 562 | pub mutable: bool, |
563 | pub type_ref: TypeRef, | 563 | pub type_ref: TypeRef, |
564 | pub ast_id: FileAstId<ast::StaticDef>, | 564 | pub ast_id: FileAstId<ast::Static>, |
565 | } | 565 | } |
566 | 566 | ||
567 | #[derive(Debug, Clone, Eq, PartialEq)] | 567 | #[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 6d963c852..a94548e5d 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -83,8 +83,8 @@ impl Ctx { | |||
83 | | ast::Item::Enum(_) | 83 | | ast::Item::Enum(_) |
84 | | ast::Item::Fn(_) | 84 | | ast::Item::Fn(_) |
85 | | ast::Item::TypeAlias(_) | 85 | | ast::Item::TypeAlias(_) |
86 | | ast::Item::ConstDef(_) | 86 | | ast::Item::Const(_) |
87 | | ast::Item::StaticDef(_) | 87 | | ast::Item::Static(_) |
88 | | ast::Item::MacroCall(_) => { | 88 | | ast::Item::MacroCall(_) => { |
89 | // Skip this if we're already collecting inner items. We'll descend into all nodes | 89 | // Skip this if we're already collecting inner items. We'll descend into all nodes |
90 | // already. | 90 | // already. |
@@ -108,8 +108,8 @@ impl Ctx { | |||
108 | ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), | 108 | ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), |
109 | ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), | 109 | ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), |
110 | ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), | 110 | ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), |
111 | ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), | 111 | ast::Item::Static(ast) => self.lower_static(ast).map(Into::into), |
112 | ast::Item::ConstDef(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::TraitDef(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), |
@@ -160,7 +160,7 @@ impl Ctx { | |||
160 | match item { | 160 | match item { |
161 | ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), | 161 | ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), |
162 | ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), | 162 | ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), |
163 | ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), | 163 | ast::AssocItem::Const(ast) => Some(self.lower_const(ast).into()), |
164 | ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), | 164 | ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), |
165 | } | 165 | } |
166 | } | 166 | } |
@@ -368,7 +368,7 @@ impl Ctx { | |||
368 | Some(id(self.data().type_aliases.alloc(res))) | 368 | Some(id(self.data().type_aliases.alloc(res))) |
369 | } | 369 | } |
370 | 370 | ||
371 | fn lower_static(&mut self, static_: &ast::StaticDef) -> Option<FileItemTreeId<Static>> { | 371 | fn lower_static(&mut self, static_: &ast::Static) -> Option<FileItemTreeId<Static>> { |
372 | let name = static_.name()?.as_name(); | 372 | let name = static_.name()?.as_name(); |
373 | let type_ref = self.lower_type_ref_opt(static_.ascribed_type()); | 373 | let type_ref = self.lower_type_ref_opt(static_.ascribed_type()); |
374 | let visibility = self.lower_visibility(static_); | 374 | let visibility = self.lower_visibility(static_); |
@@ -378,7 +378,7 @@ impl Ctx { | |||
378 | Some(id(self.data().statics.alloc(res))) | 378 | Some(id(self.data().statics.alloc(res))) |
379 | } | 379 | } |
380 | 380 | ||
381 | fn lower_const(&mut self, konst: &ast::ConstDef) -> FileItemTreeId<Const> { | 381 | fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId<Const> { |
382 | let name = konst.name().map(|it| it.as_name()); | 382 | let name = konst.name().map(|it| it.as_name()); |
383 | let type_ref = self.lower_type_ref_opt(konst.ascribed_type()); | 383 | let type_ref = self.lower_type_ref_opt(konst.ascribed_type()); |
384 | let visibility = self.lower_visibility(konst); | 384 | let visibility = self.lower_visibility(konst); |
@@ -553,7 +553,7 @@ impl Ctx { | |||
553 | self.data().functions[func.index].is_unsafe = true; | 553 | self.data().functions[func.index].is_unsafe = true; |
554 | func.into() | 554 | func.into() |
555 | } | 555 | } |
556 | ast::ExternItem::StaticDef(ast) => { | 556 | ast::ExternItem::Static(ast) => { |
557 | let statik = self.lower_static(&ast)?; | 557 | let statik = self.lower_static(&ast)?; |
558 | statik.into() | 558 | statik.into() |
559 | } | 559 | } |
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs index bf3474c51..e61ce58bc 100644 --- a/crates/ra_hir_def/src/item_tree/tests.rs +++ b/crates/ra_hir_def/src/item_tree/tests.rs | |||
@@ -238,7 +238,7 @@ fn smoke() { | |||
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 }]) }] |
241 | > Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) } | 241 | > Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Const>(9) } |
242 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }] | 242 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }] |
243 | > Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(10) } | 243 | > Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(10) } |
244 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }] | 244 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }] |
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index c2a03dfed..f75e3bb50 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs | |||
@@ -15,8 +15,8 @@ use crate::{ | |||
15 | pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; | 15 | pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; |
16 | 16 | ||
17 | pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new(); | 17 | pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new(); |
18 | pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); | 18 | pub const CONST: Key<ast::Const, ConstId> = Key::new(); |
19 | pub const STATIC: Key<ast::StaticDef, 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::TraitDef, TraitId> = 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 7d9050a6b..87221d964 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! | 2 | //! |
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_DEF` 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_DEF`. |
7 | //! | 7 | //! |
8 | //! # Examples | 8 | //! # Examples |
@@ -87,7 +87,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | SyntaxKind::CONST_DEF => { | 90 | SyntaxKind::CONST => { |
91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) | 91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) |
92 | .into_iter() | 92 | .into_iter() |
93 | .filter_map(|item| match item { | 93 | .filter_map(|item| match item { |
@@ -106,10 +106,9 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
106 | 106 | ||
107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | 107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { |
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 | 109 | SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { |
110 | | SyntaxKind::TYPE_ALIAS | 110 | Some((p, 2)) |
111 | | SyntaxKind::CONST_DEF | 111 | } |
112 | | SyntaxKind::BLOCK_EXPR => Some((p, 2)), | ||
113 | SyntaxKind::NAME_REF => Some((p, 5)), | 112 | SyntaxKind::NAME_REF => Some((p, 5)), |
114 | _ => None, | 113 | _ => None, |
115 | })?; | 114 | })?; |
@@ -201,7 +200,7 @@ fn add_const_impl( | |||
201 | } | 200 | } |
202 | } | 201 | } |
203 | 202 | ||
204 | fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { | 203 | fn make_const_compl_syntax(const_: &ast::Const) -> String { |
205 | let const_ = edit::remove_attrs_and_docs(const_); | 204 | let const_ = edit::remove_attrs_and_docs(const_); |
206 | 205 | ||
207 | let const_start = const_.syntax().text_range().start(); | 206 | let const_start = const_.syntax().text_range().start(); |
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index e81e8436f..3efca0649 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs | |||
@@ -54,7 +54,7 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String { | |||
54 | buf | 54 | buf |
55 | } | 55 | } |
56 | 56 | ||
57 | pub(crate) fn const_label(node: &ast::ConstDef) -> String { | 57 | pub(crate) fn const_label(node: &ast::Const) -> String { |
58 | let label: String = node | 58 | let label: String = node |
59 | .syntax() | 59 | .syntax() |
60 | .children_with_tokens() | 60 | .children_with_tokens() |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index c30b91fe0..9e2c01245 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -385,8 +385,8 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option | |||
385 | ast::TraitDef(it) => it.doc_comment_text(), | 385 | ast::TraitDef(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::ConstDef(it) => it.doc_comment_text(), | 388 | ast::Const(it) => it.doc_comment_text(), |
389 | ast::StaticDef(it) => it.doc_comment_text(), | 389 | ast::Static(it) => it.doc_comment_text(), |
390 | ast::RecordField(it) => it.doc_comment_text(), | 390 | ast::RecordField(it) => it.doc_comment_text(), |
391 | ast::Variant(it) => it.doc_comment_text(), | 391 | ast::Variant(it) => it.doc_comment_text(), |
392 | ast::MacroCall(it) => it.doc_comment_text(), | 392 | ast::MacroCall(it) => it.doc_comment_text(), |
@@ -410,8 +410,8 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
410 | ast::TraitDef(it) => it.short_label(), | 410 | ast::TraitDef(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::ConstDef(it) => it.short_label(), | 413 | ast::Const(it) => it.short_label(), |
414 | ast::StaticDef(it) => it.short_label(), | 414 | ast::Static(it) => it.short_label(), |
415 | ast::RecordField(it) => it.short_label(), | 415 | ast::RecordField(it) => it.short_label(), |
416 | ast::Variant(it) => it.short_label(), | 416 | ast::Variant(it) => it.short_label(), |
417 | _ => None, | 417 | _ => None, |
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index ddf1059ee..282f362f2 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -53,13 +53,13 @@ impl ShortLabel for ast::TypeAlias { | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | impl ShortLabel for ast::ConstDef { | 56 | impl ShortLabel for ast::Const { |
57 | fn short_label(&self) -> Option<String> { | 57 | fn short_label(&self) -> Option<String> { |
58 | short_label_from_ascribed_node(self, "const ") | 58 | short_label_from_ascribed_node(self, "const ") |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | impl ShortLabel for ast::StaticDef { | 62 | impl ShortLabel for ast::Static { |
63 | fn short_label(&self) -> Option<String> { | 63 | fn short_label(&self) -> Option<String> { |
64 | short_label_from_ascribed_node(self, "static ") | 64 | short_label_from_ascribed_node(self, "static ") |
65 | } | 65 | } |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 43202499d..77384b6ec 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs | |||
@@ -137,8 +137,8 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
137 | decl_with_type_ref(it, ty) | 137 | decl_with_type_ref(it, ty) |
138 | }, | 138 | }, |
139 | ast::RecordField(it) => decl_with_ascription(it), | 139 | ast::RecordField(it) => decl_with_ascription(it), |
140 | ast::ConstDef(it) => decl_with_ascription(it), | 140 | ast::Const(it) => decl_with_ascription(it), |
141 | ast::StaticDef(it) => decl_with_ascription(it), | 141 | ast::Static(it) => decl_with_ascription(it), |
142 | ast::ImplDef(it) => { | 142 | ast::ImplDef(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(); |
@@ -350,7 +350,7 @@ fn very_obsolete() {} | |||
350 | label: "S", | 350 | label: "S", |
351 | navigation_range: 201..202, | 351 | navigation_range: 201..202, |
352 | node_range: 194..213, | 352 | node_range: 194..213, |
353 | kind: STATIC_DEF, | 353 | kind: STATIC, |
354 | detail: Some( | 354 | detail: Some( |
355 | "i32", | 355 | "i32", |
356 | ), | 356 | ), |
@@ -361,7 +361,7 @@ fn very_obsolete() {} | |||
361 | label: "C", | 361 | label: "C", |
362 | navigation_range: 220..221, | 362 | navigation_range: 220..221, |
363 | node_range: 214..232, | 363 | node_range: 214..232, |
364 | kind: CONST_DEF, | 364 | kind: CONST, |
365 | detail: Some( | 365 | detail: Some( |
366 | "i32", | 366 | "i32", |
367 | ), | 367 | ), |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index ce890c816..19ec73d2a 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -714,8 +714,8 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | |||
714 | RECORD_FIELD => HighlightTag::Field, | 714 | RECORD_FIELD => HighlightTag::Field, |
715 | MODULE => HighlightTag::Module, | 715 | MODULE => HighlightTag::Module, |
716 | FN => HighlightTag::Function, | 716 | FN => HighlightTag::Function, |
717 | CONST_DEF => HighlightTag::Constant, | 717 | CONST => HighlightTag::Constant, |
718 | STATIC_DEF => HighlightTag::Static, | 718 | STATIC => HighlightTag::Static, |
719 | VARIANT => HighlightTag::EnumVariant, | 719 | VARIANT => HighlightTag::EnumVariant, |
720 | BIND_PAT => HighlightTag::Local, | 720 | BIND_PAT => HighlightTag::Local, |
721 | _ => default, | 721 | _ => default, |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 635cf706c..b908bd741 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -166,7 +166,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
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 | }, |
169 | ast::StaticDef(it) => { | 169 | ast::Static(it) => { |
170 | let def: hir::Static = sema.to_def(&it)?; | 170 | let def: hir::Static = sema.to_def(&it)?; |
171 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 171 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
172 | }, | 172 | }, |
@@ -178,7 +178,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
178 | let def: hir::Function = sema.to_def(&it)?; | 178 | let def: hir::Function = sema.to_def(&it)?; |
179 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 179 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
180 | }, | 180 | }, |
181 | ast::ConstDef(it) => { | 181 | ast::Const(it) => { |
182 | let def: hir::Const = sema.to_def(&it)?; | 182 | let def: hir::Const = sema.to_def(&it)?; |
183 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 183 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
184 | }, | 184 | }, |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 646d338ae..41b8d07f4 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -403,8 +403,8 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { | |||
403 | ast::TraitDef(it) => decl(it), | 403 | ast::TraitDef(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::ConstDef(it) => decl(it), | 406 | ast::Const(it) => decl(it), |
407 | ast::StaticDef(it) => decl(it), | 407 | ast::Static(it) => decl(it), |
408 | ast::MacroCall(it) => { | 408 | ast::MacroCall(it) => { |
409 | if it.is_macro_rules().is_some() { | 409 | if it.is_macro_rules().is_some() { |
410 | decl(it) | 410 | decl(it) |
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs index 742a7e056..35ad766dc 100644 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ b/crates/ra_parser/src/grammar/items/consts.rs | |||
@@ -3,11 +3,11 @@ | |||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { |
6 | const_or_static(p, m, T![static], STATIC_DEF) | 6 | const_or_static(p, m, T![static], STATIC) |
7 | } | 7 | } |
8 | 8 | ||
9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { | 9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { |
10 | const_or_static(p, m, T![const], CONST_DEF) | 10 | const_or_static(p, m, T![const], CONST) |
11 | } | 11 | } |
12 | 12 | ||
13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 3b82347f3..64889676e 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -131,8 +131,8 @@ pub enum SyntaxKind { | |||
131 | EXTERN_CRATE, | 131 | EXTERN_CRATE, |
132 | MODULE, | 132 | MODULE, |
133 | USE, | 133 | USE, |
134 | STATIC_DEF, | 134 | STATIC, |
135 | CONST_DEF, | 135 | CONST, |
136 | TRAIT_DEF, | 136 | TRAIT_DEF, |
137 | IMPL_DEF, | 137 | IMPL_DEF, |
138 | TYPE_ALIAS, | 138 | TYPE_ALIAS, |
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 9e23b5805..a10ade375 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -146,42 +146,28 @@ impl SysrootCrateData { | |||
146 | } | 146 | } |
147 | 147 | ||
148 | const SYSROOT_CRATES: &str = " | 148 | const SYSROOT_CRATES: &str = " |
149 | std | ||
150 | core | ||
151 | alloc | 149 | alloc |
152 | collections | 150 | core |
153 | libc | ||
154 | proc_macro | ||
155 | rustc_unicode | ||
156 | std_unicode | ||
157 | test | ||
158 | alloc_jemalloc | ||
159 | alloc_system | ||
160 | compiler_builtins | ||
161 | getopts | ||
162 | panic_unwind | ||
163 | panic_abort | 151 | panic_abort |
164 | rand | 152 | panic_unwind |
153 | proc_macro | ||
154 | profiler_builtins | ||
155 | rtstartup | ||
156 | std | ||
157 | stdarch | ||
165 | term | 158 | term |
166 | unwind | 159 | test |
167 | build_helper | 160 | unwind"; |
168 | rustc_asan | ||
169 | rustc_lsan | ||
170 | rustc_msan | ||
171 | rustc_tsan | ||
172 | syntax"; | ||
173 | 161 | ||
174 | const STD_DEPS: &str = " | 162 | const STD_DEPS: &str = " |
175 | alloc | 163 | alloc |
176 | alloc_jemalloc | ||
177 | alloc_system | ||
178 | core | 164 | core |
179 | panic_abort | 165 | panic_abort |
180 | rand | 166 | panic_unwind |
181 | compiler_builtins | 167 | profiler_builtins |
182 | unwind | 168 | rtstartup |
183 | rustc_asan | 169 | proc_macro |
184 | rustc_lsan | 170 | stdarch |
185 | rustc_msan | 171 | term |
186 | rustc_tsan | 172 | test |
187 | build_helper"; | 173 | unwind"; |
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index b69b6e85e..fd426ece9 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -139,7 +139,7 @@ fn test_doc_comment_of_statics() { | |||
139 | ) | 139 | ) |
140 | .ok() | 140 | .ok() |
141 | .unwrap(); | 141 | .unwrap(); |
142 | let st = file.syntax().descendants().find_map(StaticDef::cast).unwrap(); | 142 | let st = file.syntax().descendants().find_map(Static::cast).unwrap(); |
143 | assert_eq!("Number of levels", st.doc_comment_text().unwrap()); | 143 | assert_eq!("Number of levels", st.doc_comment_text().unwrap()); |
144 | } | 144 | } |
145 | 145 | ||
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 6613b54ba..00a70fce0 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -28,16 +28,17 @@ impl Attr { | |||
28 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 28 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
29 | } | 29 | } |
30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
31 | pub struct ConstDef { | 31 | pub struct Const { |
32 | pub(crate) syntax: SyntaxNode, | 32 | pub(crate) syntax: SyntaxNode, |
33 | } | 33 | } |
34 | impl ast::AttrsOwner for ConstDef {} | 34 | impl ast::AttrsOwner for Const {} |
35 | impl ast::NameOwner for ConstDef {} | 35 | impl ast::NameOwner for Const {} |
36 | impl ast::VisibilityOwner for ConstDef {} | 36 | impl ast::VisibilityOwner for Const {} |
37 | impl ast::TypeAscriptionOwner for ConstDef {} | 37 | impl ast::TypeAscriptionOwner for Const {} |
38 | impl ConstDef { | 38 | impl Const { |
39 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 39 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
40 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 40 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
41 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
41 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 42 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
42 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 43 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
43 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 44 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
@@ -139,14 +140,14 @@ impl Module { | |||
139 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 140 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
140 | } | 141 | } |
141 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 142 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
142 | pub struct StaticDef { | 143 | pub struct Static { |
143 | pub(crate) syntax: SyntaxNode, | 144 | pub(crate) syntax: SyntaxNode, |
144 | } | 145 | } |
145 | impl ast::AttrsOwner for StaticDef {} | 146 | impl ast::AttrsOwner for Static {} |
146 | impl ast::NameOwner for StaticDef {} | 147 | impl ast::NameOwner for Static {} |
147 | impl ast::VisibilityOwner for StaticDef {} | 148 | impl ast::VisibilityOwner for Static {} |
148 | impl ast::TypeAscriptionOwner for StaticDef {} | 149 | impl ast::TypeAscriptionOwner for Static {} |
149 | impl StaticDef { | 150 | impl Static { |
150 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | 151 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
151 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 152 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
152 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 153 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
@@ -1272,7 +1273,7 @@ impl MetaItem { | |||
1272 | } | 1273 | } |
1273 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1274 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1274 | pub enum Item { | 1275 | pub enum Item { |
1275 | ConstDef(ConstDef), | 1276 | Const(Const), |
1276 | Enum(Enum), | 1277 | Enum(Enum), |
1277 | ExternBlock(ExternBlock), | 1278 | ExternBlock(ExternBlock), |
1278 | ExternCrate(ExternCrate), | 1279 | ExternCrate(ExternCrate), |
@@ -1280,7 +1281,7 @@ pub enum Item { | |||
1280 | ImplDef(ImplDef), | 1281 | ImplDef(ImplDef), |
1281 | MacroCall(MacroCall), | 1282 | MacroCall(MacroCall), |
1282 | Module(Module), | 1283 | Module(Module), |
1283 | StaticDef(StaticDef), | 1284 | Static(Static), |
1284 | Struct(Struct), | 1285 | Struct(Struct), |
1285 | TraitDef(TraitDef), | 1286 | TraitDef(TraitDef), |
1286 | TypeAlias(TypeAlias), | 1287 | TypeAlias(TypeAlias), |
@@ -1365,7 +1366,7 @@ pub enum Expr { | |||
1365 | pub enum AssocItem { | 1366 | pub enum AssocItem { |
1366 | Fn(Fn), | 1367 | Fn(Fn), |
1367 | TypeAlias(TypeAlias), | 1368 | TypeAlias(TypeAlias), |
1368 | ConstDef(ConstDef), | 1369 | Const(Const), |
1369 | MacroCall(MacroCall), | 1370 | MacroCall(MacroCall), |
1370 | } | 1371 | } |
1371 | impl ast::AttrsOwner for AssocItem {} | 1372 | impl ast::AttrsOwner for AssocItem {} |
@@ -1384,7 +1385,7 @@ pub enum AttrInput { | |||
1384 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1385 | pub enum ExternItem { | 1386 | pub enum ExternItem { |
1386 | Fn(Fn), | 1387 | Fn(Fn), |
1387 | StaticDef(StaticDef), | 1388 | Static(Static), |
1388 | } | 1389 | } |
1389 | impl ast::AttrsOwner for ExternItem {} | 1390 | impl ast::AttrsOwner for ExternItem {} |
1390 | impl ast::NameOwner for ExternItem {} | 1391 | impl ast::NameOwner for ExternItem {} |
@@ -1421,8 +1422,8 @@ impl AstNode for Attr { | |||
1421 | } | 1422 | } |
1422 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1423 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1423 | } | 1424 | } |
1424 | impl AstNode for ConstDef { | 1425 | impl AstNode for Const { |
1425 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } | 1426 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } |
1426 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1427 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1427 | if Self::can_cast(syntax.kind()) { | 1428 | if Self::can_cast(syntax.kind()) { |
1428 | Some(Self { syntax }) | 1429 | Some(Self { syntax }) |
@@ -1509,8 +1510,8 @@ impl AstNode for Module { | |||
1509 | } | 1510 | } |
1510 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1511 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1511 | } | 1512 | } |
1512 | impl AstNode for StaticDef { | 1513 | impl AstNode for Static { |
1513 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } | 1514 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } |
1514 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1515 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1515 | if Self::can_cast(syntax.kind()) { | 1516 | if Self::can_cast(syntax.kind()) { |
1516 | Some(Self { syntax }) | 1517 | Some(Self { syntax }) |
@@ -2774,8 +2775,8 @@ impl AstNode for MetaItem { | |||
2774 | } | 2775 | } |
2775 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2776 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2776 | } | 2777 | } |
2777 | impl From<ConstDef> for Item { | 2778 | impl From<Const> for Item { |
2778 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } | 2779 | fn from(node: Const) -> Item { Item::Const(node) } |
2779 | } | 2780 | } |
2780 | impl From<Enum> for Item { | 2781 | impl From<Enum> for Item { |
2781 | fn from(node: Enum) -> Item { Item::Enum(node) } | 2782 | fn from(node: Enum) -> Item { Item::Enum(node) } |
@@ -2798,8 +2799,8 @@ impl From<MacroCall> for Item { | |||
2798 | impl From<Module> for Item { | 2799 | impl From<Module> for Item { |
2799 | fn from(node: Module) -> Item { Item::Module(node) } | 2800 | fn from(node: Module) -> Item { Item::Module(node) } |
2800 | } | 2801 | } |
2801 | impl From<StaticDef> for Item { | 2802 | impl From<Static> for Item { |
2802 | fn from(node: StaticDef) -> Item { Item::StaticDef(node) } | 2803 | fn from(node: Static) -> Item { Item::Static(node) } |
2803 | } | 2804 | } |
2804 | impl From<Struct> for Item { | 2805 | impl From<Struct> for Item { |
2805 | fn from(node: Struct) -> Item { Item::Struct(node) } | 2806 | fn from(node: Struct) -> Item { Item::Struct(node) } |
@@ -2819,14 +2820,14 @@ impl From<Use> for Item { | |||
2819 | impl AstNode for Item { | 2820 | impl AstNode for Item { |
2820 | fn can_cast(kind: SyntaxKind) -> bool { | 2821 | fn can_cast(kind: SyntaxKind) -> bool { |
2821 | match kind { | 2822 | match kind { |
2822 | CONST_DEF | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | 2823 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL | MODULE |
2823 | | MODULE | STATIC_DEF | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, | 2824 | | STATIC | STRUCT | TRAIT_DEF | TYPE_ALIAS | UNION | USE => true, |
2824 | _ => false, | 2825 | _ => false, |
2825 | } | 2826 | } |
2826 | } | 2827 | } |
2827 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2828 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2828 | let res = match syntax.kind() { | 2829 | let res = match syntax.kind() { |
2829 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), | 2830 | CONST => Item::Const(Const { syntax }), |
2830 | ENUM => Item::Enum(Enum { syntax }), | 2831 | ENUM => Item::Enum(Enum { syntax }), |
2831 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), | 2832 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), |
2832 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), | 2833 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), |
@@ -2834,7 +2835,7 @@ impl AstNode for Item { | |||
2834 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), | 2835 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), |
2835 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), | 2836 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), |
2836 | MODULE => Item::Module(Module { syntax }), | 2837 | MODULE => Item::Module(Module { syntax }), |
2837 | STATIC_DEF => Item::StaticDef(StaticDef { syntax }), | 2838 | STATIC => Item::Static(Static { syntax }), |
2838 | STRUCT => Item::Struct(Struct { syntax }), | 2839 | STRUCT => Item::Struct(Struct { syntax }), |
2839 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), | 2840 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), |
2840 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), | 2841 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), |
@@ -2846,7 +2847,7 @@ impl AstNode for Item { | |||
2846 | } | 2847 | } |
2847 | fn syntax(&self) -> &SyntaxNode { | 2848 | fn syntax(&self) -> &SyntaxNode { |
2848 | match self { | 2849 | match self { |
2849 | Item::ConstDef(it) => &it.syntax, | 2850 | Item::Const(it) => &it.syntax, |
2850 | Item::Enum(it) => &it.syntax, | 2851 | Item::Enum(it) => &it.syntax, |
2851 | Item::ExternBlock(it) => &it.syntax, | 2852 | Item::ExternBlock(it) => &it.syntax, |
2852 | Item::ExternCrate(it) => &it.syntax, | 2853 | Item::ExternCrate(it) => &it.syntax, |
@@ -2854,7 +2855,7 @@ impl AstNode for Item { | |||
2854 | Item::ImplDef(it) => &it.syntax, | 2855 | Item::ImplDef(it) => &it.syntax, |
2855 | Item::MacroCall(it) => &it.syntax, | 2856 | Item::MacroCall(it) => &it.syntax, |
2856 | Item::Module(it) => &it.syntax, | 2857 | Item::Module(it) => &it.syntax, |
2857 | Item::StaticDef(it) => &it.syntax, | 2858 | Item::Static(it) => &it.syntax, |
2858 | Item::Struct(it) => &it.syntax, | 2859 | Item::Struct(it) => &it.syntax, |
2859 | Item::TraitDef(it) => &it.syntax, | 2860 | Item::TraitDef(it) => &it.syntax, |
2860 | Item::TypeAlias(it) => &it.syntax, | 2861 | Item::TypeAlias(it) => &it.syntax, |
@@ -3256,8 +3257,8 @@ impl From<Fn> for AssocItem { | |||
3256 | impl From<TypeAlias> for AssocItem { | 3257 | impl From<TypeAlias> for AssocItem { |
3257 | fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } | 3258 | fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } |
3258 | } | 3259 | } |
3259 | impl From<ConstDef> for AssocItem { | 3260 | impl From<Const> for AssocItem { |
3260 | fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } | 3261 | fn from(node: Const) -> AssocItem { AssocItem::Const(node) } |
3261 | } | 3262 | } |
3262 | impl From<MacroCall> for AssocItem { | 3263 | impl From<MacroCall> for AssocItem { |
3263 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } | 3264 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } |
@@ -3265,7 +3266,7 @@ impl From<MacroCall> for AssocItem { | |||
3265 | impl AstNode for AssocItem { | 3266 | impl AstNode for AssocItem { |
3266 | fn can_cast(kind: SyntaxKind) -> bool { | 3267 | fn can_cast(kind: SyntaxKind) -> bool { |
3267 | match kind { | 3268 | match kind { |
3268 | FN | TYPE_ALIAS | CONST_DEF | MACRO_CALL => true, | 3269 | FN | TYPE_ALIAS | CONST | MACRO_CALL => true, |
3269 | _ => false, | 3270 | _ => false, |
3270 | } | 3271 | } |
3271 | } | 3272 | } |
@@ -3273,7 +3274,7 @@ impl AstNode for AssocItem { | |||
3273 | let res = match syntax.kind() { | 3274 | let res = match syntax.kind() { |
3274 | FN => AssocItem::Fn(Fn { syntax }), | 3275 | FN => AssocItem::Fn(Fn { syntax }), |
3275 | TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), | 3276 | TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), |
3276 | CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }), | 3277 | CONST => AssocItem::Const(Const { syntax }), |
3277 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), | 3278 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), |
3278 | _ => return None, | 3279 | _ => return None, |
3279 | }; | 3280 | }; |
@@ -3283,7 +3284,7 @@ impl AstNode for AssocItem { | |||
3283 | match self { | 3284 | match self { |
3284 | AssocItem::Fn(it) => &it.syntax, | 3285 | AssocItem::Fn(it) => &it.syntax, |
3285 | AssocItem::TypeAlias(it) => &it.syntax, | 3286 | AssocItem::TypeAlias(it) => &it.syntax, |
3286 | AssocItem::ConstDef(it) => &it.syntax, | 3287 | AssocItem::Const(it) => &it.syntax, |
3287 | AssocItem::MacroCall(it) => &it.syntax, | 3288 | AssocItem::MacroCall(it) => &it.syntax, |
3288 | } | 3289 | } |
3289 | } | 3290 | } |
@@ -3347,20 +3348,20 @@ impl AstNode for AttrInput { | |||
3347 | impl From<Fn> for ExternItem { | 3348 | impl From<Fn> for ExternItem { |
3348 | fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } | 3349 | fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } |
3349 | } | 3350 | } |
3350 | impl From<StaticDef> for ExternItem { | 3351 | impl From<Static> for ExternItem { |
3351 | fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) } | 3352 | fn from(node: Static) -> ExternItem { ExternItem::Static(node) } |
3352 | } | 3353 | } |
3353 | impl AstNode for ExternItem { | 3354 | impl AstNode for ExternItem { |
3354 | fn can_cast(kind: SyntaxKind) -> bool { | 3355 | fn can_cast(kind: SyntaxKind) -> bool { |
3355 | match kind { | 3356 | match kind { |
3356 | FN | STATIC_DEF => true, | 3357 | FN | STATIC => true, |
3357 | _ => false, | 3358 | _ => false, |
3358 | } | 3359 | } |
3359 | } | 3360 | } |
3360 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3361 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3361 | let res = match syntax.kind() { | 3362 | let res = match syntax.kind() { |
3362 | FN => ExternItem::Fn(Fn { syntax }), | 3363 | FN => ExternItem::Fn(Fn { syntax }), |
3363 | STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }), | 3364 | STATIC => ExternItem::Static(Static { syntax }), |
3364 | _ => return None, | 3365 | _ => return None, |
3365 | }; | 3366 | }; |
3366 | Some(res) | 3367 | Some(res) |
@@ -3368,7 +3369,7 @@ impl AstNode for ExternItem { | |||
3368 | fn syntax(&self) -> &SyntaxNode { | 3369 | fn syntax(&self) -> &SyntaxNode { |
3369 | match self { | 3370 | match self { |
3370 | ExternItem::Fn(it) => &it.syntax, | 3371 | ExternItem::Fn(it) => &it.syntax, |
3371 | ExternItem::StaticDef(it) => &it.syntax, | 3372 | ExternItem::Static(it) => &it.syntax, |
3372 | } | 3373 | } |
3373 | } | 3374 | } |
3374 | } | 3375 | } |
@@ -3465,7 +3466,7 @@ impl std::fmt::Display for Attr { | |||
3465 | std::fmt::Display::fmt(self.syntax(), f) | 3466 | std::fmt::Display::fmt(self.syntax(), f) |
3466 | } | 3467 | } |
3467 | } | 3468 | } |
3468 | impl std::fmt::Display for ConstDef { | 3469 | impl std::fmt::Display for Const { |
3469 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3470 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3470 | std::fmt::Display::fmt(self.syntax(), f) | 3471 | std::fmt::Display::fmt(self.syntax(), f) |
3471 | } | 3472 | } |
@@ -3505,7 +3506,7 @@ impl std::fmt::Display for Module { | |||
3505 | std::fmt::Display::fmt(self.syntax(), f) | 3506 | std::fmt::Display::fmt(self.syntax(), f) |
3506 | } | 3507 | } |
3507 | } | 3508 | } |
3508 | impl std::fmt::Display for StaticDef { | 3509 | impl std::fmt::Display for Static { |
3509 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3510 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3510 | std::fmt::Display::fmt(self.syntax(), f) | 3511 | std::fmt::Display::fmt(self.syntax(), f) |
3511 | } | 3512 | } |
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 05ec49cec..4da1d5c11 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -483,8 +483,8 @@ 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::TraitDef {} |
485 | impl ast::DocCommentsOwner for ast::Module {} | 485 | impl ast::DocCommentsOwner for ast::Module {} |
486 | impl ast::DocCommentsOwner for ast::StaticDef {} | 486 | impl ast::DocCommentsOwner for ast::Static {} |
487 | impl ast::DocCommentsOwner for ast::ConstDef {} | 487 | impl ast::DocCommentsOwner for ast::Const {} |
488 | impl ast::DocCommentsOwner for ast::TypeAlias {} | 488 | impl ast::DocCommentsOwner for ast::TypeAlias {} |
489 | impl ast::DocCommentsOwner for ast::ImplDef {} | 489 | impl ast::DocCommentsOwner for ast::ImplDef {} |
490 | impl ast::DocCommentsOwner for ast::MacroCall {} | 490 | impl ast::DocCommentsOwner for ast::MacroCall {} |
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index c586dc320..95581a84b 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs | |||
@@ -146,8 +146,8 @@ 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_DEF | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF | 149 | MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT_DEF | MODULE |
150 | | MODULE | RECORD_FIELD | STATIC_DEF => { | 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(); |
153 | 153 | ||
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 5b4e14676..a666b18db 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -4,7 +4,7 @@ mod block; | |||
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | ast, match_ast, AstNode, SyntaxError, | 6 | ast, match_ast, AstNode, SyntaxError, |
7 | SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS}, | 7 | SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST, FN, INT_NUMBER, STRING, TYPE_ALIAS}, |
8 | SyntaxNode, SyntaxToken, TextSize, T, | 8 | SyntaxNode, SyntaxToken, TextSize, T, |
9 | }; | 9 | }; |
10 | use rustc_lexer::unescape::{ | 10 | use rustc_lexer::unescape::{ |
@@ -200,7 +200,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) { | |||
200 | None => return, | 200 | None => return, |
201 | }; | 201 | }; |
202 | match parent.kind() { | 202 | match parent.kind() { |
203 | FN | CONST_DEF | TYPE_ALIAS => (), | 203 | FN | CONST | TYPE_ALIAS => (), |
204 | _ => return, | 204 | _ => return, |
205 | } | 205 | } |
206 | 206 | ||
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 c0ba4fba9..b1400aa5f 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 | |||
@@ -65,7 +65,7 @@ [email protected] | |||
65 | [email protected] ")" | 65 | [email protected] ")" |
66 | [email protected] ";" | 66 | [email protected] ";" |
67 | [email protected] "\n " | 67 | [email protected] "\n " |
68 | CONST_DEF@86..115 | 68 | [email protected] |
69 | [email protected] | 69 | [email protected] |
70 | [email protected] "pub" | 70 | [email protected] "pub" |
71 | [email protected] "(" | 71 | [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 6ca1a4870..f041fa6f7 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 | |||
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "default" | 15 | [email protected] "default" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | CONST_DEF@20..36 | 17 | [email protected] |
18 | [email protected] "const" | 18 | [email protected] "const" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast index d2a18330f..a6e6552a9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast | |||
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] "{" | 17 | [email protected] "{" |
18 | [email protected] "}" | 18 | [email protected] "}" |
19 | [email protected] "\n" | 19 | [email protected] "\n" |
20 | CONST_DEF@25..46 | 20 | [email protected] |
21 | [email protected] "unsafe" | 21 | [email protected] "unsafe" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] "const" | 23 | [email protected] "const" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast index ebcc26e0d..8d761b907 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STATIC_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "static" | 3 | [email protected] "static" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast index a62ce23e6..955e00dde 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 | |||
@@ -27,7 +27,7 @@ [email protected] | |||
27 | [email protected] "Clone" | 27 | [email protected] "Clone" |
28 | [email protected] ";" | 28 | [email protected] ";" |
29 | [email protected] "\n " | 29 | [email protected] "\n " |
30 | CONST_DEF@32..45 | 30 | [email protected] |
31 | [email protected] "const" | 31 | [email protected] "const" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | [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 3ae870e17..52181ca0c 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 | |||
@@ -26,7 +26,7 @@ [email protected] | |||
26 | [email protected] "i32" | 26 | [email protected] "i32" |
27 | [email protected] ";" | 27 | [email protected] ";" |
28 | [email protected] "\n " | 28 | [email protected] "\n " |
29 | CONST_DEF@31..49 | 29 | [email protected] |
30 | [email protected] "const" | 30 | [email protected] "const" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast index 3c00a2647..0c35bf2b7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | CONST_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast index 97d90dc75..9374cf5e9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast +++ b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STATIC_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "static" | 3 | [email protected] "static" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -18,7 +18,7 @@ [email protected] | |||
18 | [email protected] "1" | 18 | [email protected] "1" |
19 | [email protected] ";" | 19 | [email protected] ";" |
20 | [email protected] "\n" | 20 | [email protected] "\n" |
21 | STATIC_DEF@21..46 | 21 | [email protected] |
22 | [email protected] "static" | 22 | [email protected] "static" |
23 | [email protected] " " | 23 | [email protected] " " |
24 | [email protected] "mut" | 24 | [email protected] "mut" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast index d241f034c..dd1b9c9a0 100644 --- a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | CONST_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "_" | 5 | [email protected] "_" |
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] "0" | 17 | [email protected] "0" |
18 | [email protected] ";" | 18 | [email protected] ";" |
19 | [email protected] "\n" | 19 | [email protected] "\n" |
20 | CONST_DEF@18..38 | 20 | [email protected] |
21 | [email protected] "const" | 21 | [email protected] "const" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] | 23 | [email protected] |
@@ -36,7 +36,7 @@ [email protected] | |||
36 | [email protected] "92" | 36 | [email protected] "92" |
37 | [email protected] ";" | 37 | [email protected] ";" |
38 | [email protected] "\n" | 38 | [email protected] "\n" |
39 | CONST_DEF@39..63 | 39 | [email protected] |
40 | [email protected] "const" | 40 | [email protected] "const" |
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] "mut" | 42 | [email protected] "mut" |
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 584b2faf1..485efe20c 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 | |||
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "{" | 20 | [email protected] "{" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | CONST_DEF@19..43 | 22 | [email protected] |
23 | [email protected] "default" | 23 | [email protected] "default" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | [email protected] "const" | 25 | [email protected] "const" |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index dcd81da6e..fd5123301 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -40,8 +40,8 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { | |||
40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, | 40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, |
41 | SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, | 41 | SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, |
42 | SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, | 42 | SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, |
43 | SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, | 43 | SyntaxKind::STATIC => lsp_types::SymbolKind::Constant, |
44 | SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, | 44 | SyntaxKind::CONST => lsp_types::SymbolKind::Constant, |
45 | SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, | 45 | SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, |
46 | _ => lsp_types::SymbolKind::Variable, | 46 | _ => lsp_types::SymbolKind::Variable, |
47 | } | 47 | } |