aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_assists/src/handlers/add_missing_impl_members.rs4
-rw-r--r--crates/ra_assists/src/handlers/change_visibility.rs4
-rw-r--r--crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs2
-rw-r--r--crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs4
-rw-r--r--crates/ra_assists/src/utils.rs2
-rw-r--r--crates/ra_hir/src/has_source.rs12
-rw-r--r--crates/ra_hir/src/semantics.rs6
-rw-r--r--crates/ra_hir/src/semantics/source_to_def.rs16
-rw-r--r--crates/ra_hir_def/src/adt.rs4
-rw-r--r--crates/ra_hir_def/src/body/lower.rs4
-rw-r--r--crates/ra_hir_def/src/child_by_source.rs2
-rw-r--r--crates/ra_hir_def/src/item_tree.rs8
-rw-r--r--crates/ra_hir_def/src/item_tree/lower.rs20
-rw-r--r--crates/ra_hir_def/src/item_tree/tests.rs2
-rw-r--r--crates/ra_hir_def/src/keys.rs6
-rw-r--r--crates/ra_ide/src/completion/complete_trait_impl.rs13
-rw-r--r--crates/ra_ide/src/display.rs2
-rw-r--r--crates/ra_ide/src/display/navigation_target.rs12
-rw-r--r--crates/ra_ide/src/display/short_label.rs6
-rw-r--r--crates/ra_ide/src/extend_selection.rs2
-rw-r--r--crates/ra_ide/src/file_structure.rs14
-rw-r--r--crates/ra_ide/src/folding_ranges.rs2
-rw-r--r--crates/ra_ide/src/references.rs2
-rw-r--r--crates/ra_ide/src/syntax_highlighting.rs6
-rw-r--r--crates/ra_ide_db/src/defs.rs6
-rw-r--r--crates/ra_ide_db/src/symbol_index.rs4
-rw-r--r--crates/ra_parser/src/grammar.rs2
-rw-r--r--crates/ra_parser/src/grammar/items/adt.rs4
-rw-r--r--crates/ra_parser/src/grammar/items/consts.rs4
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs8
-rw-r--r--crates/ra_project_model/src/sysroot.rs48
-rw-r--r--crates/ra_syntax/src/ast.rs2
-rw-r--r--crates/ra_syntax/src/ast/generated/nodes.rs115
-rw-r--r--crates/ra_syntax/src/ast/node_ext.rs8
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs4
-rw-r--r--crates/ra_syntax/src/validation.rs4
-rw-r--r--crates/ra_syntax/test_data/parser/err/0025_nope.rast20
-rw-r--r--crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/err/0043_default_const.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast2
-rw-r--r--crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0019_enums.rast26
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0023_static_items.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0024_const_item.rast6
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast4
-rw-r--r--crates/ra_syntax/test_data/parser/ok/0066_default_const.rast2
-rw-r--r--crates/rust-analyzer/src/to_proto.rs6
53 files changed, 222 insertions, 236 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 @@
1use ra_syntax::{ 1use 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};
7use test_utils::mark; 7use test_utils::mark;
@@ -36,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
36 36
37 let (offset, target) = if let Some(keyword) = item_keyword { 37 let (offset, target) = if let Some(keyword) = item_keyword {
38 let parent = keyword.parent(); 38 let parent = keyword.parent();
39 let def_kws = vec![CONST_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/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
index 2b8e273b3..ccec688ca 100644
--- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -31,7 +31,7 @@ pub(crate) fn extract_struct_from_enum_variant(
31 acc: &mut Assists, 31 acc: &mut Assists,
32 ctx: &AssistContext, 32 ctx: &AssistContext,
33) -> Option<()> { 33) -> Option<()> {
34 let variant = ctx.find_node_at_offset::<ast::EnumVariant>()?; 34 let variant = ctx.find_node_at_offset::<ast::Variant>()?;
35 let field_list = match variant.kind() { 35 let field_list = match variant.kind() {
36 ast::StructKind::Tuple(field_list) => field_list, 36 ast::StructKind::Tuple(field_list) => field_list,
37 _ => return None, 37 _ => return None,
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
index a347e3c2e..5b282a30a 100644
--- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
+++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs
@@ -22,7 +22,7 @@ use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists};
22// } 22// }
23// ``` 23// ```
24pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { 24pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
25 let variant = ctx.find_node_at_offset::<ast::EnumVariant>()?; 25 let variant = ctx.find_node_at_offset::<ast::Variant>()?;
26 let variant_name = variant.name()?; 26 let variant_name = variant.name()?;
27 let enum_name = variant.parent_enum().name()?; 27 let enum_name = variant.parent_enum().name()?;
28 let field_list = match variant.kind() { 28 let field_list = match variant.kind() {
@@ -69,7 +69,7 @@ impl From<{0}> for {1} {{
69 69
70fn existing_from_impl( 70fn existing_from_impl(
71 sema: &'_ hir::Semantics<'_, RootDatabase>, 71 sema: &'_ hir::Semantics<'_, RootDatabase>,
72 variant: &ast::EnumVariant, 72 variant: &ast::Variant,
73) -> Option<()> { 73) -> Option<()> {
74 let variant = sema.to_def(variant)?; 74 let variant = sema.to_def(variant)?;
75 let enum_ = variant.parent_enum(sema.db); 75 let enum_ = variant.parent_enum(sema.db);
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 88399f724..9581552e5 100644
--- a/crates/ra_hir/src/has_source.rs
+++ b/crates/ra_hir/src/has_source.rs
@@ -75,8 +75,8 @@ impl HasSource for Enum {
75 } 75 }
76} 76}
77impl HasSource for EnumVariant { 77impl HasSource for EnumVariant {
78 type Ast = ast::EnumVariant; 78 type Ast = ast::Variant;
79 fn source(self, db: &dyn HirDatabase) -> InFile<ast::EnumVariant> { 79 fn source(self, db: &dyn HirDatabase) -> InFile<ast::Variant> {
80 self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) 80 self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone())
81 } 81 }
82} 82}
@@ -87,14 +87,14 @@ impl HasSource for Function {
87 } 87 }
88} 88}
89impl HasSource for Const { 89impl 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}
95impl HasSource for Static { 95impl 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 f8e70fe27..32a60b789 100644
--- a/crates/ra_hir/src/semantics.rs
+++ b/crates/ra_hir/src/semantics.rs
@@ -586,12 +586,12 @@ 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),
594 (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), 594 (crate::EnumVariant, ast::Variant, enum_variant_to_def),
595 (crate::TypeParam, ast::TypeParam, type_param_to_def), 595 (crate::TypeParam, ast::TypeParam, type_param_to_def),
596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros 596 (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros
597 (crate::Local, ast::BindPat, bind_pat_to_def), 597 (crate::Local, ast::BindPat, bind_pat_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 9f81b952f..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> {
@@ -100,9 +100,9 @@ impl SourceToDefCtx<'_, '_> {
100 } 100 }
101 pub(super) fn enum_variant_to_def( 101 pub(super) fn enum_variant_to_def(
102 &mut self, 102 &mut self,
103 src: InFile<ast::EnumVariant>, 103 src: InFile<ast::Variant>,
104 ) -> Option<EnumVariantId> { 104 ) -> Option<EnumVariantId> {
105 self.to_def(src, keys::ENUM_VARIANT) 105 self.to_def(src, keys::VARIANT)
106 } 106 }
107 pub(super) fn bind_pat_to_def( 107 pub(super) fn bind_pat_to_def(
108 &mut self, 108 &mut self,
@@ -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/adt.rs b/crates/ra_hir_def/src/adt.rs
index df98ded62..231c1dfab 100644
--- a/crates/ra_hir_def/src/adt.rs
+++ b/crates/ra_hir_def/src/adt.rs
@@ -112,7 +112,7 @@ impl EnumData {
112 112
113impl HasChildSource for EnumId { 113impl HasChildSource for EnumId {
114 type ChildId = LocalEnumVariantId; 114 type ChildId = LocalEnumVariantId;
115 type Value = ast::EnumVariant; 115 type Value = ast::Variant;
116 fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { 116 fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> {
117 let src = self.lookup(db).source(db); 117 let src = self.lookup(db).source(db);
118 let mut trace = Trace::new_for_map(); 118 let mut trace = Trace::new_for_map();
@@ -123,7 +123,7 @@ impl HasChildSource for EnumId {
123 123
124fn lower_enum( 124fn lower_enum(
125 db: &dyn DefDatabase, 125 db: &dyn DefDatabase,
126 trace: &mut Trace<EnumVariantData, ast::EnumVariant>, 126 trace: &mut Trace<EnumVariantData, ast::Variant>,
127 ast: &InFile<ast::Enum>, 127 ast: &InFile<ast::Enum>,
128 module_id: ModuleId, 128 module_id: ModuleId,
129) { 129) {
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/child_by_source.rs b/crates/ra_hir_def/src/child_by_source.rs
index a885ec96d..dcb00a1d9 100644
--- a/crates/ra_hir_def/src/child_by_source.rs
+++ b/crates/ra_hir_def/src/child_by_source.rs
@@ -162,7 +162,7 @@ impl ChildBySource for EnumId {
162 let arena_map = arena_map.as_ref(); 162 let arena_map = arena_map.as_ref();
163 for (local_id, source) in arena_map.value.iter() { 163 for (local_id, source) in arena_map.value.iter() {
164 let id = EnumVariantId { parent: *self, local_id }; 164 let id = EnumVariantId { parent: *self, local_id };
165 res[keys::ENUM_VARIANT].insert(arena_map.with_value(source.clone()), id) 165 res[keys::VARIANT].insert(arena_map.with_value(source.clone()), id)
166 } 166 }
167 167
168 res 168 res
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 da7238416..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 }
@@ -259,7 +259,7 @@ impl Ctx {
259 Some(id(self.data().enums.alloc(res))) 259 Some(id(self.data().enums.alloc(res)))
260 } 260 }
261 261
262 fn lower_variants(&mut self, variants: &ast::EnumVariantList) -> IdRange<Variant> { 262 fn lower_variants(&mut self, variants: &ast::VariantList) -> IdRange<Variant> {
263 let start = self.next_variant_idx(); 263 let start = self.next_variant_idx();
264 for variant in variants.variants() { 264 for variant in variants.variants() {
265 if let Some(data) = self.lower_variant(&variant) { 265 if let Some(data) = self.lower_variant(&variant) {
@@ -271,7 +271,7 @@ impl Ctx {
271 IdRange::new(start..end) 271 IdRange::new(start..end)
272 } 272 }
273 273
274 fn lower_variant(&mut self, variant: &ast::EnumVariant) -> Option<Variant> { 274 fn lower_variant(&mut self, variant: &ast::Variant) -> Option<Variant> {
275 let name = variant.name()?.as_name(); 275 let name = variant.name()?.as_name();
276 let fields = self.lower_fields(&variant.kind()); 276 let fields = self.lower_fields(&variant.kind());
277 let res = Variant { name, fields }; 277 let res = Variant { name, fields };
@@ -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 2695e8c24..f75e3bb50 100644
--- a/crates/ra_hir_def/src/keys.rs
+++ b/crates/ra_hir_def/src/keys.rs
@@ -15,8 +15,8 @@ use crate::{
15pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; 15pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>;
16 16
17pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new(); 17pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new();
18pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); 18pub const CONST: Key<ast::Const, ConstId> = Key::new();
19pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); 19pub const STATIC: Key<ast::Static, StaticId> = Key::new();
20pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new(); 20pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new();
21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); 21pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new();
22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); 22pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new();
@@ -24,7 +24,7 @@ pub const STRUCT: Key<ast::Struct, StructId> = Key::new();
24pub const UNION: Key<ast::Union, UnionId> = Key::new(); 24pub const UNION: Key<ast::Union, UnionId> = Key::new();
25pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); 25pub const ENUM: Key<ast::Enum, EnumId> = Key::new();
26 26
27pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); 27pub const VARIANT: Key<ast::Variant, EnumVariantId> = Key::new();
28pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new(); 28pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new();
29pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new(); 29pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new();
30pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); 30pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = 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
107fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { 107fn 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
204fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { 203fn 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
57pub(crate) fn const_label(node: &ast::ConstDef) -> String { 57pub(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 02fefd6bb..9e2c01245 100644
--- a/crates/ra_ide/src/display/navigation_target.rs
+++ b/crates/ra_ide/src/display/navigation_target.rs
@@ -385,10 +385,10 @@ 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::EnumVariant(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(),
393 _ => None, 393 _ => None,
394 } 394 }
@@ -410,10 +410,10 @@ 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::EnumVariant(it) => it.short_label(), 416 ast::Variant(it) => it.short_label(),
417 _ => None, 417 _ => None,
418 } 418 }
419 } 419 }
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs
index 5bf70937f..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
56impl ShortLabel for ast::ConstDef { 56impl 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
62impl ShortLabel for ast::StaticDef { 62impl 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 }
@@ -71,7 +71,7 @@ impl ShortLabel for ast::RecordField {
71 } 71 }
72} 72}
73 73
74impl ShortLabel for ast::EnumVariant { 74impl ShortLabel for ast::Variant {
75 fn short_label(&self) -> Option<String> { 75 fn short_label(&self) -> Option<String> {
76 Some(self.name()?.text().to_string()) 76 Some(self.name()?.text().to_string())
77 } 77 }
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs
index 04a7f0ac4..fc81b48cc 100644
--- a/crates/ra_ide/src/extend_selection.rs
+++ b/crates/ra_ide/src/extend_selection.rs
@@ -42,7 +42,7 @@ fn try_extend_selection(
42 RECORD_FIELD_LIST, 42 RECORD_FIELD_LIST,
43 TUPLE_FIELD_LIST, 43 TUPLE_FIELD_LIST,
44 RECORD_EXPR_FIELD_LIST, 44 RECORD_EXPR_FIELD_LIST,
45 ENUM_VARIANT_LIST, 45 VARIANT_LIST,
46 USE_TREE_LIST, 46 USE_TREE_LIST,
47 GENERIC_PARAM_LIST, 47 GENERIC_PARAM_LIST,
48 TYPE_ARG_LIST, 48 TYPE_ARG_LIST,
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs
index c909f96aa..77384b6ec 100644
--- a/crates/ra_ide/src/file_structure.rs
+++ b/crates/ra_ide/src/file_structure.rs
@@ -129,7 +129,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
129 ast::Struct(it) => decl(it), 129 ast::Struct(it) => decl(it),
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::EnumVariant(it) => decl(it), 132 ast::Variant(it) => decl(it),
133 ast::TraitDef(it) => decl(it), 133 ast::TraitDef(it) => decl(it),
134 ast::Module(it) => decl(it), 134 ast::Module(it) => decl(it),
135 ast::TypeAlias(it) => { 135 ast::TypeAlias(it) => {
@@ -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();
@@ -319,7 +319,7 @@ fn very_obsolete() {}
319 label: "X", 319 label: "X",
320 navigation_range: 169..170, 320 navigation_range: 169..170,
321 node_range: 169..170, 321 node_range: 169..170,
322 kind: ENUM_VARIANT, 322 kind: VARIANT,
323 detail: None, 323 detail: None,
324 deprecated: false, 324 deprecated: false,
325 }, 325 },
@@ -330,7 +330,7 @@ fn very_obsolete() {}
330 label: "Y", 330 label: "Y",
331 navigation_range: 172..173, 331 navigation_range: 172..173,
332 node_range: 172..178, 332 node_range: 172..178,
333 kind: ENUM_VARIANT, 333 kind: VARIANT,
334 detail: None, 334 detail: None,
335 deprecated: false, 335 deprecated: false,
336 }, 336 },
@@ -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/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs
index 8dcce9f56..5a6e17936 100644
--- a/crates/ra_ide/src/folding_ranges.rs
+++ b/crates/ra_ide/src/folding_ranges.rs
@@ -93,7 +93,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> {
93 | USE_TREE_LIST 93 | USE_TREE_LIST
94 | BLOCK_EXPR 94 | BLOCK_EXPR
95 | MATCH_ARM_LIST 95 | MATCH_ARM_LIST
96 | ENUM_VARIANT_LIST 96 | VARIANT_LIST
97 | TOKEN_TREE => Some(FoldKind::Block), 97 | TOKEN_TREE => Some(FoldKind::Block),
98 _ => None, 98 _ => None,
99 } 99 }
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs
index 2a62dab6c..519e4bf1a 100644
--- a/crates/ra_ide/src/references.rs
+++ b/crates/ra_ide/src/references.rs
@@ -390,7 +390,7 @@ enum Foo {
390} 390}
391"#, 391"#,
392 ); 392 );
393 check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); 393 check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]);
394 } 394 }
395 395
396 #[test] 396 #[test]
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs
index 7e2833bd5..19ec73d2a 100644
--- a/crates/ra_ide/src/syntax_highlighting.rs
+++ b/crates/ra_ide/src/syntax_highlighting.rs
@@ -714,9 +714,9 @@ 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 ENUM_VARIANT => HighlightTag::EnumVariant, 719 VARIANT => HighlightTag::EnumVariant,
720 BIND_PAT => HighlightTag::Local, 720 BIND_PAT => HighlightTag::Local,
721 _ => default, 721 _ => default,
722 }; 722 };
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs
index 586b3d750..b908bd741 100644
--- a/crates/ra_ide_db/src/defs.rs
+++ b/crates/ra_ide_db/src/defs.rs
@@ -166,11 +166,11 @@ 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 },
173 ast::EnumVariant(it) => { 173 ast::Variant(it) => {
174 let def: hir::EnumVariant = sema.to_def(&it)?; 174 let def: hir::EnumVariant = sema.to_def(&it)?;
175 Some(NameClass::Definition(Definition::ModuleDef(def.into()))) 175 Some(NameClass::Definition(Definition::ModuleDef(def.into())))
176 }, 176 },
@@ -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.rs b/crates/ra_parser/src/grammar.rs
index 03041d110..22a7acdf3 100644
--- a/crates/ra_parser/src/grammar.rs
+++ b/crates/ra_parser/src/grammar.rs
@@ -144,7 +144,7 @@ pub(crate) fn reparser(
144 BLOCK_EXPR => expressions::block_expr, 144 BLOCK_EXPR => expressions::block_expr,
145 RECORD_FIELD_LIST => items::record_field_def_list, 145 RECORD_FIELD_LIST => items::record_field_def_list,
146 RECORD_EXPR_FIELD_LIST => items::record_field_list, 146 RECORD_EXPR_FIELD_LIST => items::record_field_list,
147 ENUM_VARIANT_LIST => items::enum_variant_list, 147 VARIANT_LIST => items::enum_variant_list,
148 MATCH_ARM_LIST => items::match_arm_list, 148 MATCH_ARM_LIST => items::match_arm_list,
149 USE_TREE_LIST => items::use_tree_list, 149 USE_TREE_LIST => items::use_tree_list,
150 EXTERN_ITEM_LIST => items::extern_item_list, 150 EXTERN_ITEM_LIST => items::extern_item_list,
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs
index aeb7ce86b..addfb59d4 100644
--- a/crates/ra_parser/src/grammar/items/adt.rs
+++ b/crates/ra_parser/src/grammar/items/adt.rs
@@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) {
91 if p.eat(T![=]) { 91 if p.eat(T![=]) {
92 expressions::expr(p); 92 expressions::expr(p);
93 } 93 }
94 var.complete(p, ENUM_VARIANT); 94 var.complete(p, VARIANT);
95 } else { 95 } else {
96 var.abandon(p); 96 var.abandon(p);
97 p.err_and_bump("expected enum variant"); 97 p.err_and_bump("expected enum variant");
@@ -101,7 +101,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) {
101 } 101 }
102 } 102 }
103 p.expect(T!['}']); 103 p.expect(T!['}']);
104 m.complete(p, ENUM_VARIANT_LIST); 104 m.complete(p, VARIANT_LIST);
105} 105}
106 106
107pub(crate) fn record_field_def_list(p: &mut Parser) { 107pub(crate) fn record_field_def_list(p: &mut Parser) {
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 @@
3use super::*; 3use super::*;
4 4
5pub(super) fn static_def(p: &mut Parser, m: Marker) { 5pub(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
9pub(super) fn const_def(p: &mut Parser, m: Marker) { 9pub(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
13fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { 13fn 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 fde9e55f1..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,
@@ -206,12 +206,12 @@ pub enum SyntaxKind {
206 BIN_EXPR, 206 BIN_EXPR,
207 EXTERN_BLOCK, 207 EXTERN_BLOCK,
208 EXTERN_ITEM_LIST, 208 EXTERN_ITEM_LIST,
209 ENUM_VARIANT, 209 VARIANT,
210 RECORD_FIELD_LIST, 210 RECORD_FIELD_LIST,
211 RECORD_FIELD, 211 RECORD_FIELD,
212 TUPLE_FIELD_LIST, 212 TUPLE_FIELD_LIST,
213 TUPLE_FIELD, 213 TUPLE_FIELD,
214 ENUM_VARIANT_LIST, 214 VARIANT_LIST,
215 ITEM_LIST, 215 ITEM_LIST,
216 ASSOC_ITEM_LIST, 216 ASSOC_ITEM_LIST,
217 ATTR, 217 ATTR,
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
148const SYSROOT_CRATES: &str = " 148const SYSROOT_CRATES: &str = "
149std
150core
151alloc 149alloc
152collections 150core
153libc
154proc_macro
155rustc_unicode
156std_unicode
157test
158alloc_jemalloc
159alloc_system
160compiler_builtins
161getopts
162panic_unwind
163panic_abort 151panic_abort
164rand 152panic_unwind
153proc_macro
154profiler_builtins
155rtstartup
156std
157stdarch
165term 158term
166unwind 159test
167build_helper 160unwind";
168rustc_asan
169rustc_lsan
170rustc_msan
171rustc_tsan
172syntax";
173 161
174const STD_DEPS: &str = " 162const STD_DEPS: &str = "
175alloc 163alloc
176alloc_jemalloc
177alloc_system
178core 164core
179panic_abort 165panic_abort
180rand 166panic_unwind
181compiler_builtins 167profiler_builtins
182unwind 168rtstartup
183rustc_asan 169proc_macro
184rustc_lsan 170stdarch
185rustc_msan 171term
186rustc_tsan 172test
187build_helper"; 173unwind";
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 1d1452546..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)]
31pub struct ConstDef { 31pub struct Const {
32 pub(crate) syntax: SyntaxNode, 32 pub(crate) syntax: SyntaxNode,
33} 33}
34impl ast::AttrsOwner for ConstDef {} 34impl ast::AttrsOwner for Const {}
35impl ast::NameOwner for ConstDef {} 35impl ast::NameOwner for Const {}
36impl ast::VisibilityOwner for ConstDef {} 36impl ast::VisibilityOwner for Const {}
37impl ast::TypeAscriptionOwner for ConstDef {} 37impl ast::TypeAscriptionOwner for Const {}
38impl ConstDef { 38impl 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) }
@@ -53,7 +54,7 @@ impl ast::VisibilityOwner for Enum {}
53impl ast::GenericParamsOwner for Enum {} 54impl ast::GenericParamsOwner for Enum {}
54impl Enum { 55impl Enum {
55 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } 56 pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) }
56 pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } 57 pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) }
57} 58}
58#[derive(Debug, Clone, PartialEq, Eq, Hash)] 59#[derive(Debug, Clone, PartialEq, Eq, Hash)]
59pub struct ExternBlock { 60pub struct ExternBlock {
@@ -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)]
142pub struct StaticDef { 143pub struct Static {
143 pub(crate) syntax: SyntaxNode, 144 pub(crate) syntax: SyntaxNode,
144} 145}
145impl ast::AttrsOwner for StaticDef {} 146impl ast::AttrsOwner for Static {}
146impl ast::NameOwner for StaticDef {} 147impl ast::NameOwner for Static {}
147impl ast::VisibilityOwner for StaticDef {} 148impl ast::VisibilityOwner for Static {}
148impl ast::TypeAscriptionOwner for StaticDef {} 149impl ast::TypeAscriptionOwner for Static {}
149impl StaticDef { 150impl 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![:]) }
@@ -427,22 +428,22 @@ impl TupleField {
427 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } 428 pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) }
428} 429}
429#[derive(Debug, Clone, PartialEq, Eq, Hash)] 430#[derive(Debug, Clone, PartialEq, Eq, Hash)]
430pub struct EnumVariantList { 431pub struct VariantList {
431 pub(crate) syntax: SyntaxNode, 432 pub(crate) syntax: SyntaxNode,
432} 433}
433impl EnumVariantList { 434impl VariantList {
434 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } 435 pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) }
435 pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } 436 pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) }
436 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } 437 pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) }
437} 438}
438#[derive(Debug, Clone, PartialEq, Eq, Hash)] 439#[derive(Debug, Clone, PartialEq, Eq, Hash)]
439pub struct EnumVariant { 440pub struct Variant {
440 pub(crate) syntax: SyntaxNode, 441 pub(crate) syntax: SyntaxNode,
441} 442}
442impl ast::AttrsOwner for EnumVariant {} 443impl ast::AttrsOwner for Variant {}
443impl ast::NameOwner for EnumVariant {} 444impl ast::NameOwner for Variant {}
444impl ast::VisibilityOwner for EnumVariant {} 445impl ast::VisibilityOwner for Variant {}
445impl EnumVariant { 446impl Variant {
446 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } 447 pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) }
447 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } 448 pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
448 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } 449 pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) }
@@ -1272,7 +1273,7 @@ impl MetaItem {
1272} 1273}
1273#[derive(Debug, Clone, PartialEq, Eq, Hash)] 1274#[derive(Debug, Clone, PartialEq, Eq, Hash)]
1274pub enum Item { 1275pub 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 {
1365pub enum AssocItem { 1366pub 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}
1371impl ast::AttrsOwner for AssocItem {} 1372impl 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)]
1385pub enum ExternItem { 1386pub enum ExternItem {
1386 Fn(Fn), 1387 Fn(Fn),
1387 StaticDef(StaticDef), 1388 Static(Static),
1388} 1389}
1389impl ast::AttrsOwner for ExternItem {} 1390impl ast::AttrsOwner for ExternItem {}
1390impl ast::NameOwner for ExternItem {} 1391impl 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}
1424impl AstNode for ConstDef { 1425impl 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}
1512impl AstNode for StaticDef { 1513impl 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 })
@@ -1806,8 +1807,8 @@ impl AstNode for TupleField {
1806 } 1807 }
1807 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1808 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1808} 1809}
1809impl AstNode for EnumVariantList { 1810impl AstNode for VariantList {
1810 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } 1811 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST }
1811 fn cast(syntax: SyntaxNode) -> Option<Self> { 1812 fn cast(syntax: SyntaxNode) -> Option<Self> {
1812 if Self::can_cast(syntax.kind()) { 1813 if Self::can_cast(syntax.kind()) {
1813 Some(Self { syntax }) 1814 Some(Self { syntax })
@@ -1817,8 +1818,8 @@ impl AstNode for EnumVariantList {
1817 } 1818 }
1818 fn syntax(&self) -> &SyntaxNode { &self.syntax } 1819 fn syntax(&self) -> &SyntaxNode { &self.syntax }
1819} 1820}
1820impl AstNode for EnumVariant { 1821impl AstNode for Variant {
1821 fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } 1822 fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT }
1822 fn cast(syntax: SyntaxNode) -> Option<Self> { 1823 fn cast(syntax: SyntaxNode) -> Option<Self> {
1823 if Self::can_cast(syntax.kind()) { 1824 if Self::can_cast(syntax.kind()) {
1824 Some(Self { syntax }) 1825 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}
2777impl From<ConstDef> for Item { 2778impl From<Const> for Item {
2778 fn from(node: ConstDef) -> Item { Item::ConstDef(node) } 2779 fn from(node: Const) -> Item { Item::Const(node) }
2779} 2780}
2780impl From<Enum> for Item { 2781impl 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 {
2798impl From<Module> for Item { 2799impl From<Module> for Item {
2799 fn from(node: Module) -> Item { Item::Module(node) } 2800 fn from(node: Module) -> Item { Item::Module(node) }
2800} 2801}
2801impl From<StaticDef> for Item { 2802impl From<Static> for Item {
2802 fn from(node: StaticDef) -> Item { Item::StaticDef(node) } 2803 fn from(node: Static) -> Item { Item::Static(node) }
2803} 2804}
2804impl From<Struct> for Item { 2805impl 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 {
2819impl AstNode for Item { 2820impl 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 {
3256impl From<TypeAlias> for AssocItem { 3257impl From<TypeAlias> for AssocItem {
3257 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } 3258 fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) }
3258} 3259}
3259impl From<ConstDef> for AssocItem { 3260impl From<Const> for AssocItem {
3260 fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } 3261 fn from(node: Const) -> AssocItem { AssocItem::Const(node) }
3261} 3262}
3262impl From<MacroCall> for AssocItem { 3263impl 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 {
3265impl AstNode for AssocItem { 3266impl 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 {
3347impl From<Fn> for ExternItem { 3348impl From<Fn> for ExternItem {
3348 fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } 3349 fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) }
3349} 3350}
3350impl From<StaticDef> for ExternItem { 3351impl From<Static> for ExternItem {
3351 fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) } 3352 fn from(node: Static) -> ExternItem { ExternItem::Static(node) }
3352} 3353}
3353impl AstNode for ExternItem { 3354impl 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}
3468impl std::fmt::Display for ConstDef { 3469impl 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}
3508impl std::fmt::Display for StaticDef { 3509impl 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 }
@@ -3640,12 +3641,12 @@ impl std::fmt::Display for TupleField {
3640 std::fmt::Display::fmt(self.syntax(), f) 3641 std::fmt::Display::fmt(self.syntax(), f)
3641 } 3642 }
3642} 3643}
3643impl std::fmt::Display for EnumVariantList { 3644impl std::fmt::Display for VariantList {
3644 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3645 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3645 std::fmt::Display::fmt(self.syntax(), f) 3646 std::fmt::Display::fmt(self.syntax(), f)
3646 } 3647 }
3647} 3648}
3648impl std::fmt::Display for EnumVariant { 3649impl std::fmt::Display for Variant {
3649 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 3650 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
3650 std::fmt::Display::fmt(self.syntax(), f) 3651 std::fmt::Display::fmt(self.syntax(), f)
3651 } 3652 }
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs
index 02e6e52c2..4da1d5c11 100644
--- a/crates/ra_syntax/src/ast/node_ext.rs
+++ b/crates/ra_syntax/src/ast/node_ext.rs
@@ -247,7 +247,7 @@ impl ast::RecordFieldPat {
247 } 247 }
248} 248}
249 249
250impl ast::EnumVariant { 250impl ast::Variant {
251 pub fn parent_enum(&self) -> ast::Enum { 251 pub fn parent_enum(&self) -> ast::Enum {
252 self.syntax() 252 self.syntax()
253 .parent() 253 .parent()
@@ -480,11 +480,11 @@ impl ast::DocCommentsOwner for ast::Union {}
480impl ast::DocCommentsOwner for ast::RecordField {} 480impl ast::DocCommentsOwner for ast::RecordField {}
481impl ast::DocCommentsOwner for ast::TupleField {} 481impl ast::DocCommentsOwner for ast::TupleField {}
482impl ast::DocCommentsOwner for ast::Enum {} 482impl ast::DocCommentsOwner for ast::Enum {}
483impl ast::DocCommentsOwner for ast::EnumVariant {} 483impl ast::DocCommentsOwner for ast::Variant {}
484impl ast::DocCommentsOwner for ast::TraitDef {} 484impl ast::DocCommentsOwner for ast::TraitDef {}
485impl ast::DocCommentsOwner for ast::Module {} 485impl ast::DocCommentsOwner for ast::Module {}
486impl ast::DocCommentsOwner for ast::StaticDef {} 486impl ast::DocCommentsOwner for ast::Static {}
487impl ast::DocCommentsOwner for ast::ConstDef {} 487impl ast::DocCommentsOwner for ast::Const {}
488impl ast::DocCommentsOwner for ast::TypeAlias {} 488impl ast::DocCommentsOwner for ast::TypeAlias {}
489impl ast::DocCommentsOwner for ast::ImplDef {} 489impl ast::DocCommentsOwner for ast::ImplDef {}
490impl ast::DocCommentsOwner for ast::MacroCall {} 490impl ast::DocCommentsOwner for ast::MacroCall {}
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index faffd0d32..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 | 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
5use crate::{ 5use 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};
10use rustc_lexer::unescape::{ 10use 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/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
index 94456e48c..fca646557 100644
--- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast
+++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast
@@ -17,15 +17,15 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "Test" 18 [email protected] "Test"
19 [email protected] " " 19 [email protected] " "
20 ENUM_[email protected] 20 [email protected]
21 [email protected] "{" 21 [email protected] "{"
22 [email protected] "\n " 22 [email protected] "\n "
23 ENUM_[email protected] 23 [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "Var1" 25 [email protected] "Var1"
26 [email protected] "," 26 [email protected] ","
27 [email protected] "\n " 27 [email protected] "\n "
28 ENUM_[email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Var2" 30 [email protected] "Var2"
31 [email protected] 31 [email protected]
@@ -39,7 +39,7 @@ [email protected]
39 [email protected] ")" 39 [email protected] ")"
40 [email protected] "," 40 [email protected] ","
41 [email protected] "\n " 41 [email protected] "\n "
42 ENUM_[email protected] 42 [email protected]
43 [email protected] 43 [email protected]
44 [email protected] "Var3" 44 [email protected] "Var3"
45 [email protected] " " 45 [email protected] " "
@@ -85,10 +85,10 @@ [email protected]
85 [email protected] 85 [email protected]
86 [email protected] "Test2" 86 [email protected] "Test2"
87 [email protected] " " 87 [email protected] " "
88 ENUM_[email protected] 88 [email protected]
89 [email protected] "{" 89 [email protected] "{"
90 [email protected] "\n " 90 [email protected] "\n "
91 ENUM_[email protected] 91 [email protected]
92 [email protected] 92 [email protected]
93 [email protected] "Fine" 93 [email protected] "Fine"
94 [email protected] "," 94 [email protected] ","
@@ -101,10 +101,10 @@ [email protected]
101 [email protected] 101 [email protected]
102 [email protected] "Test3" 102 [email protected] "Test3"
103 [email protected] " " 103 [email protected] " "
104 ENUM_[email protected] 104 [email protected]
105 [email protected] "{" 105 [email protected] "{"
106 [email protected] "\n " 106 [email protected] "\n "
107 ENUM_[email protected] 107 [email protected]
108 [email protected] 108 [email protected]
109 [email protected] "StillFine" 109 [email protected] "StillFine"
110 [email protected] " " 110 [email protected] " "
@@ -140,10 +140,10 @@ [email protected]
140 [email protected] 140 [email protected]
141 [email protected] "Test4" 141 [email protected] "Test4"
142 [email protected] " " 142 [email protected] " "
143 ENUM_[email protected] 143 [email protected]
144 [email protected] "{" 144 [email protected] "{"
145 [email protected] "\n " 145 [email protected] "\n "
146 ENUM_[email protected] 146 [email protected]
147 [email protected] 147 [email protected]
148 [email protected] "Nope" 148 [email protected] "Nope"
149 [email protected] 149 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast
index 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/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
index 25e6cc170..f2561abd6 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast
@@ -4,7 +4,7 @@ [email protected]
4 [email protected] " " 4 [email protected] " "
5 [email protected] 5 [email protected]
6 [email protected] "F" 6 [email protected] "F"
7 ENUM_[email protected] 7 [email protected]
8 [email protected] "{" 8 [email protected] "{"
9 [email protected] "}" 9 [email protected] "}"
10 [email protected] "\n" 10 [email protected] "\n"
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
index 9cc8172e0..429a0506e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast
@@ -17,15 +17,15 @@ [email protected]
17 [email protected] 17 [email protected]
18 [email protected] "LocalEnum" 18 [email protected] "LocalEnum"
19 [email protected] " " 19 [email protected] " "
20 ENUM_[email protected] 20 [email protected]
21 [email protected] "{" 21 [email protected] "{"
22 [email protected] "\n " 22 [email protected] "\n "
23 ENUM_[email protected] 23 [email protected]
24 [email protected] 24 [email protected]
25 [email protected] "One" 25 [email protected] "One"
26 [email protected] "," 26 [email protected] ","
27 [email protected] "\n " 27 [email protected] "\n "
28 ENUM_[email protected] 28 [email protected]
29 [email protected] 29 [email protected]
30 [email protected] "Two" 30 [email protected] "Two"
31 [email protected] "," 31 [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/inline/ok/0157_variant_discriminant.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
index 0331558d2..a2e05eb2e 100644
--- a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
+++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast
@@ -5,10 +5,10 @@ [email protected]
5 [email protected] 5 [email protected]
6 [email protected] "E" 6 [email protected] "E"
7 [email protected] " " 7 [email protected] " "
8 ENUM_[email protected] 8 [email protected]
9 [email protected] "{" 9 [email protected] "{"
10 [email protected] " " 10 [email protected] " "
11 ENUM_[email protected] 11 [email protected]
12 [email protected] 12 [email protected]
13 [email protected] "X" 13 [email protected] "X"
14 [email protected] 14 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
index 1ffcffc1a..c3df00814 100644
--- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast
@@ -5,7 +5,7 @@ [email protected]
5 [email protected] 5 [email protected]
6 [email protected] "E1" 6 [email protected] "E1"
7 [email protected] " " 7 [email protected] " "
8 ENUM_[email protected] 8 [email protected]
9 [email protected] "{" 9 [email protected] "{"
10 [email protected] "\n" 10 [email protected] "\n"
11 [email protected] "}" 11 [email protected] "}"
@@ -22,7 +22,7 @@ [email protected]
22 [email protected] "T" 22 [email protected] "T"
23 [email protected] ">" 23 [email protected] ">"
24 [email protected] " " 24 [email protected] " "
25 ENUM_[email protected] 25 [email protected]
26 [email protected] "{" 26 [email protected] "{"
27 [email protected] "\n" 27 [email protected] "\n"
28 [email protected] "}" 28 [email protected] "}"
@@ -33,10 +33,10 @@ [email protected]
33 [email protected] 33 [email protected]
34 [email protected] "E3" 34 [email protected] "E3"
35 [email protected] " " 35 [email protected] " "
36 ENUM_[email protected] 36 [email protected]
37 [email protected] "{" 37 [email protected] "{"
38 [email protected] "\n " 38 [email protected] "\n "
39 ENUM_[email protected] 39 [email protected]
40 [email protected] 40 [email protected]
41 [email protected] "X" 41 [email protected] "X"
42 [email protected] "\n" 42 [email protected] "\n"
@@ -48,10 +48,10 @@ [email protected]
48 [email protected] 48 [email protected]
49 [email protected] "E4" 49 [email protected] "E4"
50 [email protected] " " 50 [email protected] " "
51 ENUM_[email protected] 51 [email protected]
52 [email protected] "{" 52 [email protected] "{"
53 [email protected] "\n " 53 [email protected] "\n "
54 ENUM_[email protected] 54 [email protected]
55 [email protected] 55 [email protected]
56 [email protected] "X" 56 [email protected] "X"
57 [email protected] "," 57 [email protected] ","
@@ -64,15 +64,15 @@ [email protected]
64 [email protected] 64 [email protected]
65 [email protected] "E5" 65 [email protected] "E5"
66 [email protected] " " 66 [email protected] " "
67 ENUM_[email protected] 67 [email protected]
68 [email protected] "{" 68 [email protected] "{"
69 [email protected] "\n " 69 [email protected] "\n "
70 ENUM_[email protected] 70 [email protected]
71 [email protected] 71 [email protected]
72 [email protected] "A" 72 [email protected] "A"
73 [email protected] "," 73 [email protected] ","
74 [email protected] "\n " 74 [email protected] "\n "
75 ENUM_[email protected] 75 [email protected]
76 [email protected] 76 [email protected]
77 [email protected] "B" 77 [email protected] "B"
78 [email protected] " " 78 [email protected] " "
@@ -82,7 +82,7 @@ [email protected]
82 [email protected] "92" 82 [email protected] "92"
83 [email protected] "," 83 [email protected] ","
84 [email protected] "\n " 84 [email protected] "\n "
85 ENUM_[email protected] 85 [email protected]
86 [email protected] 86 [email protected]
87 [email protected] "C" 87 [email protected] "C"
88 [email protected] " " 88 [email protected] " "
@@ -119,7 +119,7 @@ [email protected]
119 [email protected] "}" 119 [email protected] "}"
120 [email protected] "," 120 [email protected] ","
121 [email protected] "\n " 121 [email protected] "\n "
122 ENUM_[email protected] 122 [email protected]
123 [email protected] 123 [email protected]
124 [email protected] "F" 124 [email protected] "F"
125 [email protected] " " 125 [email protected] " "
@@ -128,7 +128,7 @@ [email protected]
128 [email protected] "}" 128 [email protected] "}"
129 [email protected] "," 129 [email protected] ","
130 [email protected] "\n " 130 [email protected] "\n "
131 ENUM_[email protected] 131 [email protected]
132 [email protected] 132 [email protected]
133 [email protected] "D" 133 [email protected] "D"
134 [email protected] 134 [email protected]
@@ -143,7 +143,7 @@ [email protected]
143 [email protected] ")" 143 [email protected] ")"
144 [email protected] "," 144 [email protected] ","
145 [email protected] "\n " 145 [email protected] "\n "
146 ENUM_[email protected] 146 [email protected]
147 [email protected] 147 [email protected]
148 [email protected] "E" 148 [email protected] "E"
149 [email protected] 149 [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/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
index 9db4f0aa1..7a54fa113 100644
--- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
+++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast
@@ -262,10 +262,10 @@ [email protected]
262 [email protected] 262 [email protected]
263 [email protected] "A" 263 [email protected] "A"
264 [email protected] " " 264 [email protected] " "
265 ENUM_[email protected] 265 [email protected]
266 [email protected] "{" 266 [email protected] "{"
267 [email protected] "\n " 267 [email protected] "\n "
268 ENUM_[email protected] 268 [email protected]
269 [email protected] 269 [email protected]
270 [email protected] "B" 270 [email protected] "B"
271 [email protected] 271 [email protected]
diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast
index 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 62acbfb91..fd5123301 100644
--- a/crates/rust-analyzer/src/to_proto.rs
+++ b/crates/rust-analyzer/src/to_proto.rs
@@ -34,14 +34,14 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind {
34 SyntaxKind::FN => lsp_types::SymbolKind::Function, 34 SyntaxKind::FN => lsp_types::SymbolKind::Function,
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::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, 37 SyntaxKind::VARIANT => lsp_types::SymbolKind::EnumMember,
38 SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, 38 SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface,
39 SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, 39 SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function,
40 SyntaxKind::MODULE => lsp_types::SymbolKind::Module, 40 SyntaxKind::MODULE => lsp_types::SymbolKind::Module,
41 SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, 41 SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter,
42 SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, 42 SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field,
43 SyntaxKind::STATIC_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 }