From eb2f8063444b11257111f4f8ade990ec810e0361 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:25:46 +0200 Subject: Rename TypeAliasDef -> TypeAlias --- .../src/handlers/add_missing_impl_members.rs | 8 +- .../ra_assists/src/handlers/change_visibility.rs | 4 +- crates/ra_assists/src/utils.rs | 2 +- crates/ra_hir/src/has_source.rs | 4 +- crates/ra_hir/src/semantics.rs | 2 +- crates/ra_hir/src/semantics/source_to_def.rs | 9 +-- crates/ra_hir_def/src/body/lower.rs | 2 +- crates/ra_hir_def/src/item_tree.rs | 4 +- crates/ra_hir_def/src/item_tree/lower.rs | 8 +- crates/ra_hir_def/src/item_tree/tests.rs | 2 +- crates/ra_hir_def/src/keys.rs | 2 +- .../ra_ide/src/completion/complete_trait_impl.rs | 6 +- crates/ra_ide/src/display.rs | 2 +- crates/ra_ide/src/display/navigation_target.rs | 4 +- crates/ra_ide/src/display/short_label.rs | 2 +- crates/ra_ide/src/file_structure.rs | 4 +- crates/ra_ide/src/syntax_highlighting.rs | 2 +- crates/ra_ide_db/src/defs.rs | 2 +- crates/ra_ide_db/src/symbol_index.rs | 4 +- crates/ra_parser/src/grammar/items.rs | 2 +- crates/ra_parser/src/syntax_kind/generated.rs | 2 +- crates/ra_syntax/src/ast/edit.rs | 4 +- crates/ra_syntax/src/ast/generated/nodes.rs | 92 +++++++++++----------- crates/ra_syntax/src/ast/node_ext.rs | 2 +- crates/ra_syntax/src/parsing/text_tree_sink.rs | 2 +- crates/ra_syntax/src/validation.rs | 4 +- .../parser/err/0037_visibility_in_traits.rast | 2 +- .../parser/err/0044_unexpected_for_type.rast | 8 +- .../inline/err/0001_array_type_missing_semi.rast | 2 +- .../err/0003_pointer_type_no_mutability.rast | 2 +- .../err/0005_fn_pointer_type_missing_fn.rast | 2 +- .../parser/inline/err/0014_default_fn_type.rast | 2 +- .../parser/inline/ok/0001_trait_item_list.rast | 2 +- .../ok/0004_value_parameters_no_patterns.rast | 2 +- .../inline/ok/0012_type_item_where_clause.rast | 2 +- .../parser/inline/ok/0013_pointer_type_mut.rast | 4 +- .../parser/inline/ok/0014_never_type.rast | 2 +- .../parser/inline/ok/0017_array_type.rast | 2 +- .../parser/inline/ok/0021_impl_item_list.rast | 2 +- .../parser/inline/ok/0023_placeholder_type.rast | 2 +- .../parser/inline/ok/0025_slice_type.rast | 2 +- .../parser/inline/ok/0028_impl_trait_type.rast | 2 +- .../parser/inline/ok/0032_fn_pointer_type.rast | 8 +- .../parser/inline/ok/0033_reference_type;.rast | 6 +- .../parser/inline/ok/0037_qual_paths.rast | 2 +- .../test_data/parser/inline/ok/0039_type_arg.rast | 2 +- .../inline/ok/0046_singleton_tuple_type.rast | 2 +- .../test_data/parser/inline/ok/0051_unit_type.rast | 2 +- .../test_data/parser/inline/ok/0052_path_type.rast | 8 +- .../parser/inline/ok/0065_dyn_trait_type.rast | 2 +- .../inline/ok/0073_type_item_type_params.rast | 2 +- .../test_data/parser/inline/ok/0078_type_item.rast | 2 +- .../test_data/parser/inline/ok/0081_for_type.rast | 6 +- .../parser/inline/ok/0084_paren_type.rast | 2 +- .../inline/ok/0092_fn_pointer_type_with_ret.rast | 2 +- .../parser/inline/ok/0104_path_fn_trait_args.rast | 2 +- .../parser/inline/ok/0117_macro_call_type.rast | 4 +- .../parser/inline/ok/0131_existential_type.rast | 2 +- .../parser/inline/ok/0132_default_fn_type.rast | 2 +- .../ok/0154_fn_pointer_param_ident_path.rast | 4 +- .../inline/ok/0157_fn_pointer_unnamed_arg.rast | 2 +- .../test_data/parser/ok/0055_dot_dot_dot.rast | 2 +- crates/rust-analyzer/src/to_proto.rs | 2 +- xtask/src/ast_src.rs | 2 +- xtask/src/codegen/rust.ungram | 12 +-- 65 files changed, 146 insertions(+), 155 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 4f377e37f..1e4d4748c 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs @@ -119,7 +119,7 @@ fn add_missing_impl_members_inner( let def_name = |item: &ast::AssocItem| -> Option { match item { ast::AssocItem::Fn(def) => def.name(), - ast::AssocItem::TypeAliasDef(def) => def.name(), + ast::AssocItem::TypeAlias(def) => def.name(), ast::AssocItem::ConstDef(def) => def.name(), ast::AssocItem::MacroCall(_) => None, } @@ -130,7 +130,7 @@ fn add_missing_impl_members_inner( .iter() .map(|i| match i { hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value), - hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value), + hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value), hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value), }) .filter(|t| def_name(&t).is_some()) @@ -159,9 +159,7 @@ fn add_missing_impl_members_inner( .map(|it| ast_transform::apply(&*ast_transform, it)) .map(|it| match it { ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)), - ast::AssocItem::TypeAliasDef(def) => { - ast::AssocItem::TypeAliasDef(def.remove_bounds()) - } + ast::AssocItem::TypeAlias(def) => ast::AssocItem::TypeAlias(def.remove_bounds()), _ => it, }) .map(|it| edit::remove_attrs_and_docs(&it)); diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 67b46376e..c3e1f2803 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs @@ -1,9 +1,7 @@ use ra_syntax::{ ast::{self, NameOwner, VisibilityOwner}, AstNode, - SyntaxKind::{ - CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY, - }, + SyntaxKind::{CONST_DEF, ENUM_DEF, FN, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY}, T, }; use test_utils::mark; diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index 4478ea0e2..748be011b 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs @@ -72,7 +72,7 @@ pub fn get_missing_assoc_items( } } - ast::AssocItem::TypeAliasDef(t) => { + ast::AssocItem::TypeAlias(t) => { if let Some(n) = t.name() { impl_type.insert(n.syntax().to_string()); } diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index f32b8cbb9..1557b7c83 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs @@ -105,8 +105,8 @@ impl HasSource for Trait { } } impl HasSource for TypeAlias { - type Ast = ast::TypeAliasDef; - fn source(self, db: &dyn HirDatabase) -> InFile { + type Ast = ast::TypeAlias; + fn source(self, db: &dyn HirDatabase) -> InFile { self.id.lookup(db.upcast()).source(db.upcast()) } } diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 0b634f23e..054405966 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs @@ -582,7 +582,7 @@ to_def_impls![ (crate::Union, ast::UnionDef, union_to_def), (crate::Trait, ast::TraitDef, trait_to_def), (crate::ImplDef, ast::ImplDef, impl_to_def), - (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def), + (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), (crate::Const, ast::ConstDef, const_to_def), (crate::Static, ast::StaticDef, static_to_def), (crate::Function, ast::Fn, fn_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 4118de2e2..d23a1974b 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs @@ -89,10 +89,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn const_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::CONST) } - pub(super) fn type_alias_to_def( - &mut self, - src: InFile, - ) -> Option { + pub(super) fn type_alias_to_def(&mut self, src: InFile) -> Option { self.to_def(src, keys::TYPE_ALIAS) } pub(super) fn record_field_to_def( @@ -195,7 +192,7 @@ impl SourceToDefCtx<'_, '_> { let def = self.const_to_def(container.with_value(it))?; DefWithBodyId::from(def).into() }, - ast::TypeAliasDef(it) => { + ast::TypeAlias(it) => { let def = self.type_alias_to_def(container.with_value(it))?; def.into() }, @@ -217,7 +214,7 @@ impl SourceToDefCtx<'_, '_> { ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(), ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), - ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(), + ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), _ => continue, } diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 6b13f013d..f463997e7 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -634,7 +634,7 @@ impl ExprCollector<'_> { def.name(), ) } - ast::Item::TypeAliasDef(def) => { + ast::Item::TypeAlias(def) => { let id = self.find_inner_item(&def)?; ( TypeAliasLoc { container: container.into(), id }.intern(self.db).into(), diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index 34fc9ff8e..ea61ac217 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs @@ -421,7 +421,7 @@ mod_items! { Static in statics -> ast::StaticDef, Trait in traits -> ast::TraitDef, Impl in impls -> ast::ImplDef, - TypeAlias in type_aliases -> ast::TypeAliasDef, + TypeAlias in type_aliases -> ast::TypeAlias, Mod in mods -> ast::Module, MacroCall in macro_calls -> ast::MacroCall, } @@ -592,7 +592,7 @@ pub struct TypeAlias { pub bounds: Box<[TypeBound]>, pub generic_params: GenericParamsId, pub type_ref: Option, - pub ast_id: FileAstId, + pub ast_id: FileAstId, } #[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 2764d8674..4cfc68f53 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -79,7 +79,7 @@ impl Ctx { | ast::Item::UnionDef(_) | ast::Item::EnumDef(_) | ast::Item::Fn(_) - | ast::Item::TypeAliasDef(_) + | ast::Item::TypeAlias(_) | ast::Item::ConstDef(_) | ast::Item::StaticDef(_) | ast::Item::MacroCall(_) => { @@ -104,7 +104,7 @@ impl Ctx { ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), - ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), @@ -156,7 +156,7 @@ impl Ctx { fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option { match item { ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), - ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), + ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), } @@ -348,7 +348,7 @@ impl Ctx { fn lower_type_alias( &mut self, - type_alias: &ast::TypeAliasDef, + type_alias: &ast::TypeAlias, ) -> Option> { let name = type_alias.name()?.as_name(); let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it)); diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs index 4e2f6008b..a8f5da1c1 100644 --- a/crates/ra_hir_def/src/item_tree/tests.rs +++ b/crates/ra_hir_def/src/item_tree/tests.rs @@ -236,7 +236,7 @@ fn smoke() { #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }] Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::(0)), Const(Idx::(0)), Function(Idx::(0)), Function(Idx::(1))], ast_id: FileAstId::(2) } > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }] - > 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::(8) } + > 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::(8) } > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }] > 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::(9) } > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }] diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index 7fed5523e..f627eab1f 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs @@ -17,7 +17,7 @@ pub type Key = crate::dyn_map::Key, V, AstPtrPolicy>; pub const FUNCTION: Key = Key::new(); pub const CONST: Key = Key::new(); pub const STATIC: Key = Key::new(); -pub const TYPE_ALIAS: Key = Key::new(); +pub const TYPE_ALIAS: Key = Key::new(); pub const IMPL: Key = Key::new(); pub const TRAIT: Key = Key::new(); pub const STRUCT: Key = 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 dbb9eecc6..7d9050a6b 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 @@ //! //! This module adds the completion items related to implementing associated //! items within a `impl Trait for Struct` block. The current context node -//! must be within either a `FN`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node +//! must be within either a `FN`, `TYPE_ALIAS`, or `CONST_DEF` node //! and an direct child of an `IMPL_DEF`. //! //! # Examples @@ -75,7 +75,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext } } - SyntaxKind::TYPE_ALIAS_DEF => { + SyntaxKind::TYPE_ALIAS => { for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) .into_iter() .filter_map(|item| match item { @@ -107,7 +107,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { SyntaxKind::FN - | SyntaxKind::TYPE_ALIAS_DEF + | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST_DEF | SyntaxKind::BLOCK_EXPR => Some((p, 2)), SyntaxKind::NAME_REF => Some((p, 5)), diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index e4effc66c..6d93726bf 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -65,7 +65,7 @@ pub(crate) fn const_label(node: &ast::ConstDef) -> String { label.trim().to_owned() } -pub(crate) fn type_label(node: &ast::TypeAliasDef) -> String { +pub(crate) fn type_label(node: &ast::TypeAlias) -> String { let label: String = node .syntax() .children_with_tokens() diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 222cb3502..4f19c7ed4 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs @@ -384,7 +384,7 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option ast::EnumDef(it) => it.doc_comment_text(), ast::TraitDef(it) => it.doc_comment_text(), ast::Module(it) => it.doc_comment_text(), - ast::TypeAliasDef(it) => it.doc_comment_text(), + ast::TypeAlias(it) => it.doc_comment_text(), ast::ConstDef(it) => it.doc_comment_text(), ast::StaticDef(it) => it.doc_comment_text(), ast::RecordFieldDef(it) => it.doc_comment_text(), @@ -409,7 +409,7 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> ast::EnumDef(it) => it.short_label(), ast::TraitDef(it) => it.short_label(), ast::Module(it) => it.short_label(), - ast::TypeAliasDef(it) => it.short_label(), + ast::TypeAlias(it) => it.short_label(), ast::ConstDef(it) => it.short_label(), ast::StaticDef(it) => it.short_label(), ast::RecordFieldDef(it) => it.short_label(), diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 63863943a..e2c95be06 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs @@ -47,7 +47,7 @@ impl ShortLabel for ast::Module { } } -impl ShortLabel for ast::TypeAliasDef { +impl ShortLabel for ast::TypeAlias { fn short_label(&self) -> Option { short_label_from_node(self, "type ") } diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 41603480e..8ef977761 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -132,7 +132,7 @@ fn structure_node(node: &SyntaxNode) -> Option { ast::EnumVariant(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), - ast::TypeAliasDef(it) => { + ast::TypeAlias(it) => { let ty = it.type_ref(); decl_with_type_ref(it, ty) }, @@ -339,7 +339,7 @@ fn very_obsolete() {} label: "T", navigation_range: 186..187, node_range: 181..193, - kind: TYPE_ALIAS_DEF, + kind: TYPE_ALIAS, detail: Some( "()", ), diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index 5198727d9..8d52fb6e4 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs @@ -709,7 +709,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { ENUM_DEF => HighlightTag::Enum, UNION_DEF => HighlightTag::Union, TRAIT_DEF => HighlightTag::Trait, - TYPE_ALIAS_DEF => HighlightTag::TypeAlias, + TYPE_ALIAS => HighlightTag::TypeAlias, TYPE_PARAM => HighlightTag::TypeParam, RECORD_FIELD_DEF => HighlightTag::Field, MODULE => HighlightTag::Module, diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 234d3175a..0e73a8932 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs @@ -182,7 +182,7 @@ pub fn classify_name(sema: &Semantics, name: &ast::Name) -> Option let def: hir::Const = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, - ast::TypeAliasDef(it) => { + ast::TypeAlias(it) => { let def: hir::TypeAlias = sema.to_def(&it)?; Some(NameClass::Definition(Definition::ModuleDef(def.into()))) }, diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index c6e1ad432..b4e85b88e 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs @@ -344,7 +344,7 @@ impl Query { } fn is_type(kind: SyntaxKind) -> bool { - matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF) + matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS) } /// The actual data that is stored in the index. It should be as compact as @@ -402,7 +402,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { ast::EnumDef(it) => decl(it), ast::TraitDef(it) => decl(it), ast::Module(it) => decl(it), - ast::TypeAliasDef(it) => decl(it), + ast::TypeAlias(it) => decl(it), ast::ConstDef(it) => decl(it), ast::StaticDef(it) => decl(it), ast::MacroCall(it) => { diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 7f8a51ddb..664b23f6a 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) { types::type_(p); } p.expect(T![;]); - m.complete(p, TYPE_ALIAS_DEF); + m.complete(p, TYPE_ALIAS); } pub(crate) fn mod_item(p: &mut Parser, m: Marker) { diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 1390fa407..b84c3fc79 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -135,7 +135,7 @@ pub enum SyntaxKind { CONST_DEF, TRAIT_DEF, IMPL_DEF, - TYPE_ALIAS_DEF, + TYPE_ALIAS, MACRO_CALL, TOKEN_TREE, MACRO_DEF, diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 4a67fd44a..0110300af 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs @@ -192,9 +192,9 @@ impl ast::RecordFieldList { } } -impl ast::TypeAliasDef { +impl ast::TypeAlias { #[must_use] - pub fn remove_bounds(&self) -> ast::TypeAliasDef { + pub fn remove_bounds(&self) -> ast::TypeAlias { let colon = match self.colon_token() { Some(it) => it, None => return self.clone(), diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 4fc35585d..ad8ccf1ce 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -183,15 +183,15 @@ impl TraitDef { pub fn assoc_item_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeAliasDef { +pub struct TypeAlias { pub(crate) syntax: SyntaxNode, } -impl ast::AttrsOwner for TypeAliasDef {} -impl ast::NameOwner for TypeAliasDef {} -impl ast::VisibilityOwner for TypeAliasDef {} -impl ast::TypeParamsOwner for TypeAliasDef {} -impl ast::TypeBoundsOwner for TypeAliasDef {} -impl TypeAliasDef { +impl ast::AttrsOwner for TypeAlias {} +impl ast::NameOwner for TypeAlias {} +impl ast::VisibilityOwner for TypeAlias {} +impl ast::TypeParamsOwner for TypeAlias {} +impl ast::TypeBoundsOwner for TypeAlias {} +impl TypeAlias { pub fn default_token(&self) -> Option { support::token(&self.syntax, T![default]) } pub fn type_token(&self) -> Option { support::token(&self.syntax, T![type]) } pub fn eq_token(&self) -> Option { support::token(&self.syntax, T![=]) } @@ -384,6 +384,13 @@ impl SelfParam { pub fn colon_token(&self) -> Option { support::token(&self.syntax, T![:]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] +pub struct TypeBoundList { + pub(crate) syntax: SyntaxNode, +} +impl TypeBoundList { + pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } +} +#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct RecordFieldDefList { pub(crate) syntax: SyntaxNode, } @@ -444,13 +451,6 @@ impl EnumVariant { pub fn expr(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeBoundList { - pub(crate) syntax: SyntaxNode, -} -impl TypeBoundList { - pub fn bounds(&self) -> AstChildren { support::children(&self.syntax) } -} -#[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct AssocItemList { pub(crate) syntax: SyntaxNode, } @@ -1284,7 +1284,7 @@ pub enum Item { StaticDef(StaticDef), StructDef(StructDef), TraitDef(TraitDef), - TypeAliasDef(TypeAliasDef), + TypeAlias(TypeAlias), UnionDef(UnionDef), Use(Use), } @@ -1365,7 +1365,7 @@ pub enum Expr { #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum AssocItem { Fn(Fn), - TypeAliasDef(TypeAliasDef), + TypeAlias(TypeAlias), ConstDef(ConstDef), MacroCall(MacroCall), } @@ -1543,8 +1543,8 @@ impl AstNode for TraitDef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeAliasDef { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } +impl AstNode for TypeAlias { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -1752,6 +1752,17 @@ impl AstNode for SelfParam { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } +impl AstNode for TypeBoundList { + fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } + fn cast(syntax: SyntaxNode) -> Option { + if Self::can_cast(syntax.kind()) { + Some(Self { syntax }) + } else { + None + } + } + fn syntax(&self) -> &SyntaxNode { &self.syntax } +} impl AstNode for RecordFieldDefList { fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } fn cast(syntax: SyntaxNode) -> Option { @@ -1818,17 +1829,6 @@ impl AstNode for EnumVariant { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeBoundList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } - fn cast(syntax: SyntaxNode) -> Option { - if Self::can_cast(syntax.kind()) { - Some(Self { syntax }) - } else { - None - } - } - fn syntax(&self) -> &SyntaxNode { &self.syntax } -} impl AstNode for AssocItemList { fn can_cast(kind: SyntaxKind) -> bool { kind == ASSOC_ITEM_LIST } fn cast(syntax: SyntaxNode) -> Option { @@ -2808,8 +2808,8 @@ impl From for Item { impl From for Item { fn from(node: TraitDef) -> Item { Item::TraitDef(node) } } -impl From for Item { - fn from(node: TypeAliasDef) -> Item { Item::TypeAliasDef(node) } +impl From for Item { + fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } } impl From for Item { fn from(node: UnionDef) -> Item { Item::UnionDef(node) } @@ -2821,9 +2821,7 @@ impl AstNode for Item { fn can_cast(kind: SyntaxKind) -> bool { match kind { CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL_DEF | MACRO_CALL - | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | USE => { - true - } + | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS | UNION_DEF | USE => true, _ => false, } } @@ -2840,7 +2838,7 @@ impl AstNode for Item { STATIC_DEF => Item::StaticDef(StaticDef { syntax }), STRUCT_DEF => Item::StructDef(StructDef { syntax }), TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), - TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }), + TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), UNION_DEF => Item::UnionDef(UnionDef { syntax }), USE => Item::Use(Use { syntax }), _ => return None, @@ -2860,7 +2858,7 @@ impl AstNode for Item { Item::StaticDef(it) => &it.syntax, Item::StructDef(it) => &it.syntax, Item::TraitDef(it) => &it.syntax, - Item::TypeAliasDef(it) => &it.syntax, + Item::TypeAlias(it) => &it.syntax, Item::UnionDef(it) => &it.syntax, Item::Use(it) => &it.syntax, } @@ -3258,8 +3256,8 @@ impl AstNode for Expr { impl From for AssocItem { fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } } -impl From for AssocItem { - fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) } +impl From for AssocItem { + fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } } impl From for AssocItem { fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } @@ -3270,14 +3268,14 @@ impl From for AssocItem { impl AstNode for AssocItem { fn can_cast(kind: SyntaxKind) -> bool { match kind { - FN | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true, + FN | TYPE_ALIAS | CONST_DEF | MACRO_CALL => true, _ => false, } } fn cast(syntax: SyntaxNode) -> Option { let res = match syntax.kind() { FN => AssocItem::Fn(Fn { syntax }), - TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }), + TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }), MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), _ => return None, @@ -3287,7 +3285,7 @@ impl AstNode for AssocItem { fn syntax(&self) -> &SyntaxNode { match self { AssocItem::Fn(it) => &it.syntax, - AssocItem::TypeAliasDef(it) => &it.syntax, + AssocItem::TypeAlias(it) => &it.syntax, AssocItem::ConstDef(it) => &it.syntax, AssocItem::MacroCall(it) => &it.syntax, } @@ -3525,7 +3523,7 @@ impl std::fmt::Display for TraitDef { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeAliasDef { +impl std::fmt::Display for TypeAlias { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } @@ -3620,6 +3618,11 @@ impl std::fmt::Display for SelfParam { std::fmt::Display::fmt(self.syntax(), f) } } +impl std::fmt::Display for TypeBoundList { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + std::fmt::Display::fmt(self.syntax(), f) + } +} impl std::fmt::Display for RecordFieldDefList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) @@ -3650,11 +3653,6 @@ impl std::fmt::Display for EnumVariant { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeBoundList { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - std::fmt::Display::fmt(self.syntax(), f) - } -} impl std::fmt::Display for AssocItemList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 9fb6b7268..a7a301d6b 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs @@ -485,6 +485,6 @@ impl ast::DocCommentsOwner for ast::TraitDef {} impl ast::DocCommentsOwner for ast::Module {} impl ast::DocCommentsOwner for ast::StaticDef {} impl ast::DocCommentsOwner for ast::ConstDef {} -impl ast::DocCommentsOwner for ast::TypeAliasDef {} +impl ast::DocCommentsOwner for ast::TypeAlias {} impl ast::DocCommentsOwner for ast::ImplDef {} impl ast::DocCommentsOwner for ast::MacroCall {} diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index 2a0f95d15..87a7acd09 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs @@ -146,7 +146,7 @@ fn n_attached_trivias<'a>( trivias: impl Iterator, ) -> usize { match kind { - MACRO_CALL | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN + MACRO_CALL | CONST_DEF | TYPE_ALIAS | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN | TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => { let mut res = 0; let mut trivias = trivias.enumerate().peekable(); diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index 2714d102a..6a2749381 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs @@ -4,7 +4,7 @@ mod block; use crate::{ ast, match_ast, AstNode, SyntaxError, - SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS_DEF}, + SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN, INT_NUMBER, STRING, TYPE_ALIAS}, SyntaxNode, SyntaxToken, TextSize, T, }; use rustc_lexer::unescape::{ @@ -200,7 +200,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec) { None => return, }; match parent.kind() { - FN | CONST_DEF | TYPE_ALIAS_DEF => (), + FN | CONST_DEF | TYPE_ALIAS => (), _ => return, } 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 f180616f1..c0ba4fba9 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 @@ -46,7 +46,7 @@ SOURCE_FILE@0..118 L_CURLY@49..50 "{" R_CURLY@50..51 "}" WHITESPACE@51..56 "\n " - TYPE_ALIAS_DEF@56..81 + TYPE_ALIAS@56..81 VISIBILITY@56..66 PUB_KW@56..59 "pub" L_PAREN@59..60 "(" diff --git a/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast index 5f59c3bc2..19b3540e9 100644 --- a/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..239 - TYPE_ALIAS_DEF@0..30 + TYPE_ALIAS@0..30 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..11 @@ -26,7 +26,7 @@ SOURCE_FILE@0..239 IDENT@26..29 "u32" SEMICOLON@29..30 ";" WHITESPACE@30..31 "\n" - TYPE_ALIAS_DEF@31..64 + TYPE_ALIAS@31..64 TYPE_KW@31..35 "type" WHITESPACE@35..36 " " NAME@36..42 @@ -57,7 +57,7 @@ SOURCE_FILE@0..239 R_PAREN@62..63 ")" SEMICOLON@63..64 ";" WHITESPACE@64..65 "\n" - TYPE_ALIAS_DEF@65..95 + TYPE_ALIAS@65..95 TYPE_KW@65..69 "type" WHITESPACE@69..70 " " NAME@70..78 @@ -83,7 +83,7 @@ SOURCE_FILE@0..239 R_BRACK@93..94 "]" SEMICOLON@94..95 ";" WHITESPACE@95..96 "\n" - TYPE_ALIAS_DEF@96..149 + TYPE_ALIAS@96..149 TYPE_KW@96..100 "type" WHITESPACE@100..101 " " NAME@101..109 diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast index bf70ebca4..0b9bbec07 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..18 - TYPE_ALIAS_DEF@0..12 + TYPE_ALIAS@0..12 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast index 95bcc3c0a..2409eefe7 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..14 - TYPE_ALIAS_DEF@0..13 + TYPE_ALIAS@0..13 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast index 90202d764..776022fd9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..20 - TYPE_ALIAS_DEF@0..15 + TYPE_ALIAS@0..15 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast index b31195281..22c7c5f0d 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast @@ -14,7 +14,7 @@ SOURCE_FILE@0..62 NAME_REF@14..21 IDENT@14..21 "default" WHITESPACE@21..22 " " - TYPE_ALIAS_DEF@22..35 + TYPE_ALIAS@22..35 TYPE_KW@22..26 "type" WHITESPACE@26..27 " " NAME@27..28 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 7847ba65a..a62ce23e6 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 @@ -11,7 +11,7 @@ SOURCE_FILE@0..83 ASSOC_ITEM_LIST@7..82 L_CURLY@7..8 "{" WHITESPACE@8..13 "\n " - TYPE_ALIAS_DEF@13..27 + TYPE_ALIAS@13..27 TYPE_KW@13..17 "type" WHITESPACE@17..18 " " NAME@18..19 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast index 20eba09f5..ace8ad050 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..39 - TYPE_ALIAS_DEF@0..38 + TYPE_ALIAS@0..38 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast index 283442a8b..28c94bfd6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..31 - TYPE_ALIAS_DEF@0..30 + TYPE_ALIAS@0..30 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast index e2e871dda..845b32e6d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..36 - TYPE_ALIAS_DEF@0..17 + TYPE_ALIAS@0..17 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -16,7 +16,7 @@ SOURCE_FILE@0..36 R_PAREN@15..16 ")" SEMICOLON@16..17 ";" WHITESPACE@17..18 "\n" - TYPE_ALIAS_DEF@18..35 + TYPE_ALIAS@18..35 TYPE_KW@18..22 "type" WHITESPACE@22..23 " " NAME@23..24 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast index a60940fcf..b1d5106ce 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..16 - TYPE_ALIAS_DEF@0..15 + TYPE_ALIAS@0..15 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..10 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast index 61a0b22f4..c131df1c9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..19 - TYPE_ALIAS_DEF@0..18 + TYPE_ALIAS@0..18 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 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 daa55ec6c..3ae870e17 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 @@ -11,7 +11,7 @@ SOURCE_FILE@0..89 ASSOC_ITEM_LIST@7..88 L_CURLY@7..8 "{" WHITESPACE@8..13 "\n " - TYPE_ALIAS_DEF@13..26 + TYPE_ALIAS@13..26 TYPE_KW@13..17 "type" WHITESPACE@17..18 " " NAME@18..19 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast index 17687617b..57008e5fe 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..22 - TYPE_ALIAS_DEF@0..21 + TYPE_ALIAS@0..21 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..16 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast index 0a6d77f45..fd819ea37 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..15 - TYPE_ALIAS_DEF@0..14 + TYPE_ALIAS@0..14 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast index 93f5c738c..f45f3cab8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..43 - TYPE_ALIAS_DEF@0..42 + TYPE_ALIAS@0..42 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast index 72705e148..79a5ee339 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..113 - TYPE_ALIAS_DEF@0..14 + TYPE_ALIAS@0..14 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -14,7 +14,7 @@ SOURCE_FILE@0..113 R_PAREN@12..13 ")" SEMICOLON@13..14 ";" WHITESPACE@14..15 "\n" - TYPE_ALIAS_DEF@15..36 + TYPE_ALIAS@15..36 TYPE_KW@15..19 "type" WHITESPACE@19..20 " " NAME@20..21 @@ -31,7 +31,7 @@ SOURCE_FILE@0..113 R_PAREN@34..35 ")" SEMICOLON@35..36 ";" WHITESPACE@36..37 "\n" - TYPE_ALIAS_DEF@37..69 + TYPE_ALIAS@37..69 TYPE_KW@37..41 "type" WHITESPACE@41..42 " " NAME@42..43 @@ -53,7 +53,7 @@ SOURCE_FILE@0..113 R_PAREN@67..68 ")" SEMICOLON@68..69 ";" WHITESPACE@69..70 "\n" - TYPE_ALIAS_DEF@70..112 + TYPE_ALIAS@70..112 TYPE_KW@70..74 "type" WHITESPACE@74..75 " " NAME@75..76 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast index 784fbb592..c522f76cf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..54 - TYPE_ALIAS_DEF@0..13 + TYPE_ALIAS@0..13 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -14,7 +14,7 @@ SOURCE_FILE@0..54 R_PAREN@11..12 ")" SEMICOLON@12..13 ";" WHITESPACE@13..14 "\n" - TYPE_ALIAS_DEF@14..35 + TYPE_ALIAS@14..35 TYPE_KW@14..18 "type" WHITESPACE@18..19 " " NAME@19..20 @@ -31,7 +31,7 @@ SOURCE_FILE@0..54 R_PAREN@33..34 ")" SEMICOLON@34..35 ";" WHITESPACE@35..36 "\n" - TYPE_ALIAS_DEF@36..53 + TYPE_ALIAS@36..53 TYPE_KW@36..40 "type" WHITESPACE@40..41 " " NAME@41..42 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast index 8f6cd2e2f..b6379e62f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..71 - TYPE_ALIAS_DEF@0..26 + TYPE_ALIAS@0..26 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast index e92ea2bf2..2185d3c91 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..46 - TYPE_ALIAS_DEF@0..45 + TYPE_ALIAS@0..45 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast index c28dc9d61..e89284c14 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..17 - TYPE_ALIAS_DEF@0..16 + TYPE_ALIAS@0..16 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast index 798ef2a48..6330dbf9e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..13 - TYPE_ALIAS_DEF@0..12 + TYPE_ALIAS@0..12 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast index 0d2f5ff56..9bc36bea7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..71 - TYPE_ALIAS_DEF@0..13 + TYPE_ALIAS@0..13 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -14,7 +14,7 @@ SOURCE_FILE@0..71 IDENT@9..12 "Foo" SEMICOLON@12..13 ";" WHITESPACE@13..14 "\n" - TYPE_ALIAS_DEF@14..29 + TYPE_ALIAS@14..29 TYPE_KW@14..18 "type" WHITESPACE@18..19 " " NAME@19..20 @@ -30,7 +30,7 @@ SOURCE_FILE@0..71 IDENT@25..28 "Foo" SEMICOLON@28..29 ";" WHITESPACE@29..30 "\n" - TYPE_ALIAS_DEF@30..49 + TYPE_ALIAS@30..49 TYPE_KW@30..34 "type" WHITESPACE@34..35 " " NAME@35..36 @@ -49,7 +49,7 @@ SOURCE_FILE@0..71 IDENT@45..48 "Foo" SEMICOLON@48..49 ";" WHITESPACE@49..50 "\n" - TYPE_ALIAS_DEF@50..70 + TYPE_ALIAS@50..70 TYPE_KW@50..54 "type" WHITESPACE@54..55 " " NAME@55..56 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast index 8e10f3673..629fea99d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..42 - TYPE_ALIAS_DEF@0..41 + TYPE_ALIAS@0..41 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast index cc871ac0c..0123cb108 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..21 - TYPE_ALIAS_DEF@0..20 + TYPE_ALIAS@0..20 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..11 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast index a08e16fab..2befc8388 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..16 - TYPE_ALIAS_DEF@0..15 + TYPE_ALIAS@0..15 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index b26ac2d36..175ec9844 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..121 - TYPE_ALIAS_DEF@0..28 + TYPE_ALIAS@0..28 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -29,7 +29,7 @@ SOURCE_FILE@0..121 R_PAREN@26..27 ")" SEMICOLON@27..28 ";" WHITESPACE@28..29 "\n" - TYPE_ALIAS_DEF@29..81 + TYPE_ALIAS@29..81 TYPE_KW@29..33 "type" WHITESPACE@33..34 " " NAME@34..35 @@ -74,7 +74,7 @@ SOURCE_FILE@0..121 R_PAREN@79..80 ")" SEMICOLON@80..81 ";" WHITESPACE@81..82 "\n" - TYPE_ALIAS_DEF@82..120 + TYPE_ALIAS@82..120 TYPE_KW@82..86 "type" WHITESPACE@86..87 " " NAME@87..90 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast index 9cd8910d4..ee8894966 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..16 - TYPE_ALIAS_DEF@0..15 + TYPE_ALIAS@0..15 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast index 1e2d7db7c..95686977f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..21 - TYPE_ALIAS_DEF@0..20 + TYPE_ALIAS@0..20 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast index e3c4cfeb3..3f53d60c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..29 - TYPE_ALIAS_DEF@0..28 + TYPE_ALIAS@0..28 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast index ddfcf974e..f3d4ad72c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..41 - TYPE_ALIAS_DEF@0..16 + TYPE_ALIAS@0..16 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 @@ -18,7 +18,7 @@ SOURCE_FILE@0..41 R_PAREN@14..15 ")" SEMICOLON@15..16 ";" WHITESPACE@16..17 "\n" - TYPE_ALIAS_DEF@17..40 + TYPE_ALIAS@17..40 TYPE_KW@17..21 "type" WHITESPACE@21..22 " " NAME@22..23 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast index 4a1c2b3a4..d47071a91 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..37 - TYPE_ALIAS_DEF@0..36 + TYPE_ALIAS@0..36 EXISTENTIAL_KW@0..11 "existential" WHITESPACE@11..12 " " TYPE_KW@12..16 "type" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast index 9fc724f3f..de02238df 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast @@ -19,7 +19,7 @@ SOURCE_FILE@0..69 ASSOC_ITEM_LIST@15..68 L_CURLY@15..16 "{" WHITESPACE@16..21 "\n " - TYPE_ALIAS_DEF@21..42 + TYPE_ALIAS@21..42 DEFAULT_KW@21..28 "default" WHITESPACE@28..29 " " TYPE_KW@29..33 "type" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast index 861065362..69b4d73d7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..55 - TYPE_ALIAS_DEF@0..24 + TYPE_ALIAS@0..24 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..8 @@ -25,7 +25,7 @@ SOURCE_FILE@0..55 R_PAREN@22..23 ")" SEMICOLON@23..24 ";" WHITESPACE@24..25 "\n" - TYPE_ALIAS_DEF@25..54 + TYPE_ALIAS@25..54 TYPE_KW@25..29 "type" WHITESPACE@29..30 " " NAME@30..33 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast index fad9df007..ccca045b6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..23 - TYPE_ALIAS_DEF@0..22 + TYPE_ALIAS@0..22 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..8 diff --git a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast index 1c893180c..7447d516e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast +++ b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast @@ -1,5 +1,5 @@ SOURCE_FILE@0..49 - TYPE_ALIAS_DEF@0..12 + TYPE_ALIAS@0..12 TYPE_KW@0..4 "type" WHITESPACE@4..5 " " NAME@5..6 diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index f86e55d39..34a0d039c 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs @@ -38,7 +38,7 @@ pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, SyntaxKind::MODULE => lsp_types::SymbolKind::Module, - SyntaxKind::TYPE_ALIAS_DEF => lsp_types::SymbolKind::TypeParameter, + SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field, SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 40693ed17..e66e96d64 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -105,7 +105,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "CONST_DEF", "TRAIT_DEF", "IMPL_DEF", - "TYPE_ALIAS_DEF", + "TYPE_ALIAS", "MACRO_CALL", "TOKEN_TREE", "MACRO_DEF", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 98968dece..760a8dd95 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -15,7 +15,7 @@ Item = | StaticDef | StructDef | TraitDef -| TypeAliasDef +| TypeAlias | UnionDef | Use @@ -72,6 +72,10 @@ Param = RetType = '->' TypeRef +TypeAlias = + Attr* Visibility? 'default'? 'type' Name TypeParamList? (':' TypeBoundList?)? WhereClause? + '=' TypeRef ';' + StructDef = Attr* Visibility? 'struct' Name TypeParamList? ( WhereClause? (RecordFieldDefList | ';') @@ -124,10 +128,6 @@ StaticDef = Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef '=' body:Expr ';' -TypeAliasDef = - Attr* Visibility? 'default'? 'type' Name TypeParamList? WhereClause? (':' TypeBoundList?)? - '=' TypeRef ';' - ImplDef = Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' WhereClause? @@ -474,7 +474,7 @@ TypeRef = AssocItem = Fn -| TypeAliasDef +| TypeAlias | ConstDef | MacroCall -- cgit v1.2.3