From 28ef4c375a9f56d69daf885504aea3df7012bb81 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 30 Jul 2020 15:36:21 +0200 Subject: Rename TypeParamList -> GenericParamList --- .../ra_assists/src/handlers/generate_function.rs | 4 +-- crates/ra_assists/src/handlers/generate_impl.rs | 4 +-- crates/ra_assists/src/handlers/generate_new.rs | 5 ++-- .../src/handlers/introduce_named_lifetime.rs | 12 ++++----- crates/ra_assists/src/handlers/move_bounds.rs | 2 +- crates/ra_hir_def/src/generics.rs | 8 +++--- crates/ra_hir_def/src/item_tree/lower.rs | 6 ++--- crates/ra_hir_expand/src/builtin_derive.rs | 8 +++--- crates/ra_ide/src/display.rs | 4 +-- crates/ra_ide/src/extend_selection.rs | 2 +- crates/ra_ide/src/file_structure.rs | 4 +-- crates/ra_ide/src/references.rs | 2 +- crates/ra_parser/src/grammar/type_params.rs | 2 +- crates/ra_parser/src/syntax_kind/generated.rs | 2 +- crates/ra_syntax/src/ast.rs | 4 +-- crates/ra_syntax/src/ast/generated/nodes.rs | 30 +++++++++++----------- crates/ra_syntax/src/ast/make.rs | 2 +- crates/ra_syntax/src/ast/traits.rs | 4 +-- .../err/0009_broken_struct_type_parameter.rast | 2 +- .../test_data/parser/err/0012_broken_lambda.rast | 2 +- .../test_data/parser/err/0014_where_no_bounds.rast | 2 +- .../parser/err/0024_many_type_parens.rast | 8 +++--- .../test_data/parser/err/0026_imp_recovery.rast | 4 +-- .../parser/err/0027_incomplere_where_for.rast | 2 +- .../parser/err/0044_unexpected_for_type.rast | 18 ++++++------- .../parser/inline/ok/0003_where_pred_for.rast | 4 +-- .../inline/ok/0005_function_type_params.rast | 2 +- .../parser/inline/ok/0007_type_param_bounds.rast | 2 +- .../parser/inline/ok/0041_trait_item.rast | 4 +-- .../inline/ok/0045_param_list_opt_patterns.rast | 2 +- .../inline/ok/0073_type_item_type_params.rast | 2 +- .../inline/ok/0076_function_where_clause.rast | 2 +- .../test_data/parser/inline/ok/0081_for_type.rast | 6 ++--- .../parser/inline/ok/0090_type_param_default.rast | 2 +- .../parser/inline/ok/0114_tuple_struct_where.rast | 4 +-- .../ok/0122_generic_lifetime_type_attribute.rast | 2 +- .../inline/ok/0138_associated_type_bounds.rast | 2 +- .../parser/inline/ok/0147_const_param.rast | 2 +- .../parser/inline/ok/0150_impl_type_params.rast | 2 +- .../parser/inline/ok/0151_trait_alias.rast | 6 ++--- .../test_data/parser/ok/0001_struct_item.rast | 2 +- .../parser/ok/0018_struct_type_params.rast | 30 +++++++++++----------- .../ra_syntax/test_data/parser/ok/0019_enums.rast | 2 +- .../parser/ok/0020_type_param_bounds.rast | 20 +++++++-------- .../test_data/parser/ok/0032_where_for.rast | 4 +-- .../test_data/parser/ok/0035_weird_exprs.rast | 2 +- .../test_data/parser/ok/0036_fully_qualified.rast | 2 +- .../test_data/parser/ok/0051_parameter_attrs.rast | 8 +++--- .../parser/ok/0065_plus_after_fn_trait_bound.rast | 2 +- .../test_data/parser/ok/0067_where_for_pred.rast | 26 +++++++++---------- xtask/src/ast_src.rs | 2 +- xtask/src/codegen/gen_syntax.rs | 2 +- xtask/src/codegen/rust.ungram | 20 +++++++-------- 53 files changed, 155 insertions(+), 154 deletions(-) diff --git a/crates/ra_assists/src/handlers/generate_function.rs b/crates/ra_assists/src/handlers/generate_function.rs index 006d0ffb2..56510861d 100644 --- a/crates/ra_assists/src/handlers/generate_function.rs +++ b/crates/ra_assists/src/handlers/generate_function.rs @@ -104,7 +104,7 @@ impl FunctionTemplate { struct FunctionBuilder { target: GeneratedFunctionTarget, fn_name: ast::Name, - type_params: Option, + type_params: Option, params: ast::ParamList, file: FileId, needs_pub: bool, @@ -200,7 +200,7 @@ fn fn_args( ctx: &AssistContext, target_module: hir::Module, call: &ast::CallExpr, -) -> Option<(Option, ast::ParamList)> { +) -> Option<(Option, ast::ParamList)> { let mut arg_names = Vec::new(); let mut arg_types = Vec::new(); for arg in call.arg_list()?.args() { diff --git a/crates/ra_assists/src/handlers/generate_impl.rs b/crates/ra_assists/src/handlers/generate_impl.rs index 42eb4defa..d9b87c9c0 100644 --- a/crates/ra_assists/src/handlers/generate_impl.rs +++ b/crates/ra_assists/src/handlers/generate_impl.rs @@ -1,4 +1,4 @@ -use ra_syntax::ast::{self, AstNode, NameOwner, TypeParamsOwner}; +use ra_syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner}; use stdx::{format_to, SepBy}; use crate::{AssistContext, AssistId, AssistKind, Assists}; @@ -31,7 +31,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<() format!("Generate impl for `{}`", name), target, |edit| { - let type_params = nominal.type_param_list(); + let type_params = nominal.generic_param_list(); let start_offset = nominal.syntax().text_range().end(); let mut buf = String::new(); buf.push_str("\n\nimpl"); diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs index 4dff0ae4d..340f9b103 100644 --- a/crates/ra_assists/src/handlers/generate_new.rs +++ b/crates/ra_assists/src/handlers/generate_new.rs @@ -1,7 +1,8 @@ use hir::Adt; use ra_syntax::{ ast::{ - self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner, + self, AstNode, GenericParamsOwner, NameOwner, StructKind, TypeAscriptionOwner, + VisibilityOwner, }, T, }; @@ -91,7 +92,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> // Generates the surrounding `impl Type { }` including type and lifetime // parameters fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { - let type_params = strukt.type_param_list(); + let type_params = strukt.generic_param_list(); let mut buf = String::with_capacity(code.len()); buf.push_str("\n\nimpl"); if let Some(type_params) = &type_params { diff --git a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs index f3774fab1..4ad173ef0 100644 --- a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs +++ b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs @@ -1,5 +1,5 @@ use ra_syntax::{ - ast::{self, NameOwner, TypeAscriptionOwner, TypeParamsOwner}, + ast::{self, GenericParamsOwner, NameOwner, TypeAscriptionOwner}, AstNode, SyntaxKind, TextRange, TextSize, }; use rustc_hash::FxHashSet; @@ -54,7 +54,7 @@ fn generate_fn_def_assist( lifetime_loc: TextRange, ) -> Option<()> { let param_list: ast::ParamList = fn_def.param_list()?; - let new_lifetime_param = generate_unique_lifetime_param_name(&fn_def.type_param_list())?; + let new_lifetime_param = generate_unique_lifetime_param_name(&fn_def.generic_param_list())?; let end_of_fn_ident = fn_def.name()?.ident_token()?.text_range().end(); let self_param = // use the self if it's a reference and has no explicit lifetime @@ -96,7 +96,7 @@ fn generate_impl_def_assist( impl_def: &ast::ImplDef, lifetime_loc: TextRange, ) -> Option<()> { - let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.type_param_list())?; + let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.generic_param_list())?; let end_of_impl_kw = impl_def.impl_token()?.text_range().end(); acc.add(AssistId(ASSIST_NAME, AssistKind::Refactor), ASSIST_LABEL, lifetime_loc, |builder| { add_lifetime_param(impl_def, builder, end_of_impl_kw, new_lifetime_param); @@ -107,7 +107,7 @@ fn generate_impl_def_assist( /// Given a type parameter list, generate a unique lifetime parameter name /// which is not in the list fn generate_unique_lifetime_param_name( - existing_type_param_list: &Option, + existing_type_param_list: &Option, ) -> Option { match existing_type_param_list { Some(type_params) => { @@ -123,13 +123,13 @@ fn generate_unique_lifetime_param_name( /// Add the lifetime param to `builder`. If there are type parameters in `type_params_owner`, add it to the end. Otherwise /// add new type params brackets with the lifetime parameter at `new_type_params_loc`. -fn add_lifetime_param( +fn add_lifetime_param( type_params_owner: &TypeParamsOwner, builder: &mut AssistBuilder, new_type_params_loc: TextSize, new_lifetime_param: char, ) { - match type_params_owner.type_param_list() { + match type_params_owner.generic_param_list() { // add the new lifetime parameter to an existing type param list Some(type_params) => { builder.insert( diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index dae6198ed..69ce90fbc 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs @@ -23,7 +23,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; // } // ``` pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { - let type_param_list = ctx.find_node_at_offset::()?; + let type_param_list = ctx.find_node_at_offset::()?; let mut type_params = type_param_list.type_params(); if type_params.all(|p| p.type_bound_list().is_none()) { diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index 6a0f493a7..5fa2fbb3f 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs @@ -12,7 +12,7 @@ use hir_expand::{ use ra_arena::{map::ArenaMap, Arena}; use ra_db::FileId; use ra_prof::profile; -use ra_syntax::ast::{self, NameOwner, TypeBoundsOwner, TypeParamsOwner}; +use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner}; use crate::{ body::LowerCtx, @@ -205,9 +205,9 @@ impl GenericParams { &mut self, lower_ctx: &LowerCtx, sm: &mut SourceMap, - node: &dyn TypeParamsOwner, + node: &dyn GenericParamsOwner, ) { - if let Some(params) = node.type_param_list() { + if let Some(params) = node.generic_param_list() { self.fill_params(lower_ctx, sm, params) } if let Some(where_clause) = node.where_clause() { @@ -232,7 +232,7 @@ impl GenericParams { &mut self, lower_ctx: &LowerCtx, sm: &mut SourceMap, - params: ast::TypeParamList, + params: ast::GenericParamList, ) { for type_param in params.type_params() { let name = type_param.name().map_or_else(Name::missing, |it| it.as_name()); diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 4cfc68f53..19d165b5b 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs @@ -568,10 +568,10 @@ impl Ctx { fn lower_generic_params_and_inner_items( &mut self, owner: GenericsOwner<'_>, - node: &impl ast::TypeParamsOwner, + node: &impl ast::GenericParamsOwner, ) -> GenericParamsId { // Generics are part of item headers and may contain inner items we need to collect. - if let Some(params) = node.type_param_list() { + if let Some(params) = node.generic_param_list() { self.collect_inner_items(params.syntax()); } if let Some(clause) = node.where_clause() { @@ -584,7 +584,7 @@ impl Ctx { fn lower_generic_params( &mut self, owner: GenericsOwner<'_>, - node: &impl ast::TypeParamsOwner, + node: &impl ast::GenericParamsOwner, ) -> GenericParamsId { let mut sm = &mut ArenaMap::default(); let mut generics = GenericParams::default(); diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index 8f70a3567..3e2f0a520 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs @@ -4,7 +4,7 @@ use log::debug; use ra_parser::FragmentKind; use ra_syntax::{ - ast::{self, AstNode, ModuleItemOwner, NameOwner, TypeParamsOwner}, + ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner}, match_ast, }; @@ -72,9 +72,9 @@ fn parse_adt(tt: &tt::Subtree) -> Result { let node = item.syntax(); let (name, params) = match_ast! { match node { - ast::StructDef(it) => (it.name(), it.type_param_list()), - ast::EnumDef(it) => (it.name(), it.type_param_list()), - ast::UnionDef(it) => (it.name(), it.type_param_list()), + ast::StructDef(it) => (it.name(), it.generic_param_list()), + ast::EnumDef(it) => (it.name(), it.generic_param_list()), + ast::UnionDef(it) => (it.name(), it.generic_param_list()), _ => { debug!("unexpected node is {:?}", node); return Err(mbe::ExpandError::ConversionError) diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index 6d93726bf..e81e8436f 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs @@ -5,7 +5,7 @@ mod navigation_target; mod short_label; use ra_syntax::{ - ast::{self, AstNode, AttrsOwner, NameOwner, TypeParamsOwner}, + ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}, SyntaxKind::{ATTR, COMMENT}, }; @@ -37,7 +37,7 @@ pub(crate) fn function_declaration(node: &ast::Fn) -> String { if let Some(name) = node.name() { format_to!(buf, "fn {}", name) } - if let Some(type_params) = node.type_param_list() { + if let Some(type_params) = node.generic_param_list() { format_to!(buf, "{}", type_params); } if let Some(param_list) = node.param_list() { diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 8a6b3ea99..b1c4561c1 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -44,7 +44,7 @@ fn try_extend_selection( RECORD_FIELD_LIST, ENUM_VARIANT_LIST, USE_TREE_LIST, - TYPE_PARAM_LIST, + GENERIC_PARAM_LIST, TYPE_ARG_LIST, TYPE_BOUND_LIST, PARAM_LIST, diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 8ef977761..05ccc0b73 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs @@ -1,5 +1,5 @@ use ra_syntax::{ - ast::{self, AttrsOwner, NameOwner, TypeAscriptionOwner, TypeParamsOwner}, + ast::{self, AttrsOwner, GenericParamsOwner, NameOwner, TypeAscriptionOwner}, match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, WalkEvent, }; @@ -113,7 +113,7 @@ fn structure_node(node: &SyntaxNode) -> Option { match node { ast::Fn(it) => { let mut detail = String::from("fn"); - if let Some(type_param_list) = it.type_param_list() { + if let Some(type_param_list) = it.generic_param_list() { collapse_ws(type_param_list.syntax(), &mut detail); } if let Some(param_list) = it.param_list() { diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 8d3452a83..94d03a07f 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -175,7 +175,7 @@ fn get_struct_def_name_for_struct_literal_search( return name.syntax().ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); } if sema - .find_node_at_offset_with_descend::( + .find_node_at_offset_with_descend::( &syntax, left.text_range().start(), ) diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index d1330d4b9..90dabb4c0 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs @@ -36,7 +36,7 @@ fn type_param_list(p: &mut Parser) { } } p.expect(T![>]); - m.complete(p, TYPE_PARAM_LIST); + m.complete(p, GENERIC_PARAM_LIST); } fn lifetime_param(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 b84c3fc79..b83690865 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -230,7 +230,7 @@ pub enum SyntaxKind { NAME_REF, LET_STMT, EXPR_STMT, - TYPE_PARAM_LIST, + GENERIC_PARAM_LIST, LIFETIME_PARAM, TYPE_PARAM, CONST_PARAM, diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index c65c485cb..452e67c70 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs @@ -286,7 +286,7 @@ where let mut bounds = pred.type_bound_list().unwrap().bounds(); assert!(pred.for_token().is_none()); - assert!(pred.type_param_list().is_none()); + assert!(pred.generic_param_list().is_none()); assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); assert_bound("Clone", bounds.next()); assert_bound("Copy", bounds.next()); @@ -325,7 +325,7 @@ where let mut bounds = pred.type_bound_list().unwrap().bounds(); assert!(pred.for_token().is_some()); - assert_eq!("<'a>", pred.type_param_list().unwrap().syntax().text().to_string()); + assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string()); assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); assert_bound("Fn(&'a str)", bounds.next()); } diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index ad8ccf1ce..efe0cbe3a 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -50,7 +50,7 @@ pub struct EnumDef { impl ast::AttrsOwner for EnumDef {} impl ast::NameOwner for EnumDef {} impl ast::VisibilityOwner for EnumDef {} -impl ast::TypeParamsOwner for EnumDef {} +impl ast::GenericParamsOwner for EnumDef {} impl EnumDef { pub fn enum_token(&self) -> Option { support::token(&self.syntax, T![enum]) } pub fn variant_list(&self) -> Option { support::child(&self.syntax) } @@ -85,7 +85,7 @@ pub struct Fn { impl ast::AttrsOwner for Fn {} impl ast::NameOwner for Fn {} impl ast::VisibilityOwner for Fn {} -impl ast::TypeParamsOwner for Fn {} +impl ast::GenericParamsOwner for Fn {} impl Fn { pub fn default_token(&self) -> Option { support::token(&self.syntax, T![default]) } pub fn async_token(&self) -> Option { support::token(&self.syntax, T![async]) } @@ -104,7 +104,7 @@ pub struct ImplDef { } impl ast::AttrsOwner for ImplDef {} impl ast::VisibilityOwner for ImplDef {} -impl ast::TypeParamsOwner for ImplDef {} +impl ast::GenericParamsOwner for ImplDef {} impl ImplDef { pub fn const_token(&self) -> Option { support::token(&self.syntax, T![const]) } pub fn default_token(&self) -> Option { support::token(&self.syntax, T![default]) } @@ -161,7 +161,7 @@ pub struct StructDef { impl ast::AttrsOwner for StructDef {} impl ast::NameOwner for StructDef {} impl ast::VisibilityOwner for StructDef {} -impl ast::TypeParamsOwner for StructDef {} +impl ast::GenericParamsOwner for StructDef {} impl StructDef { pub fn struct_token(&self) -> Option { support::token(&self.syntax, T![struct]) } pub fn semicolon_token(&self) -> Option { support::token(&self.syntax, T![;]) } @@ -174,7 +174,7 @@ pub struct TraitDef { impl ast::AttrsOwner for TraitDef {} impl ast::NameOwner for TraitDef {} impl ast::VisibilityOwner for TraitDef {} -impl ast::TypeParamsOwner for TraitDef {} +impl ast::GenericParamsOwner for TraitDef {} impl ast::TypeBoundsOwner for TraitDef {} impl TraitDef { pub fn unsafe_token(&self) -> Option { support::token(&self.syntax, T![unsafe]) } @@ -189,7 +189,7 @@ pub struct TypeAlias { impl ast::AttrsOwner for TypeAlias {} impl ast::NameOwner for TypeAlias {} impl ast::VisibilityOwner for TypeAlias {} -impl ast::TypeParamsOwner for TypeAlias {} +impl ast::GenericParamsOwner for TypeAlias {} impl ast::TypeBoundsOwner for TypeAlias {} impl TypeAlias { pub fn default_token(&self) -> Option { support::token(&self.syntax, T![default]) } @@ -205,7 +205,7 @@ pub struct UnionDef { impl ast::AttrsOwner for UnionDef {} impl ast::NameOwner for UnionDef {} impl ast::VisibilityOwner for UnionDef {} -impl ast::TypeParamsOwner for UnionDef {} +impl ast::GenericParamsOwner for UnionDef {} impl UnionDef { pub fn union_token(&self) -> Option { support::token(&self.syntax, T![union]) } pub fn record_field_def_list(&self) -> Option { @@ -307,10 +307,10 @@ impl Abi { pub fn extern_token(&self) -> Option { support::token(&self.syntax, T![extern]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeParamList { +pub struct GenericParamList { pub(crate) syntax: SyntaxNode, } -impl TypeParamList { +impl GenericParamList { pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } pub fn type_params(&self) -> AstChildren { support::children(&self.syntax) } pub fn lifetime_params(&self) -> AstChildren { support::children(&self.syntax) } @@ -557,7 +557,7 @@ pub struct ForType { } impl ForType { pub fn for_token(&self) -> Option { support::token(&self.syntax, T![for]) } - pub fn type_param_list(&self) -> Option { support::child(&self.syntax) } + pub fn generic_param_list(&self) -> Option { support::child(&self.syntax) } pub fn type_ref(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] @@ -1172,7 +1172,7 @@ pub struct WherePred { impl ast::TypeBoundsOwner for WherePred {} impl WherePred { pub fn for_token(&self) -> Option { support::token(&self.syntax, T![for]) } - pub fn type_param_list(&self) -> Option { support::child(&self.syntax) } + pub fn generic_param_list(&self) -> Option { support::child(&self.syntax) } pub fn lifetime_token(&self) -> Option { support::token(&self.syntax, T![lifetime]) } @@ -1397,8 +1397,8 @@ pub enum AdtDef { UnionDef(UnionDef), } impl ast::AttrsOwner for AdtDef {} +impl ast::GenericParamsOwner for AdtDef {} impl ast::NameOwner for AdtDef {} -impl ast::TypeParamsOwner for AdtDef {} impl ast::VisibilityOwner for AdtDef {} impl AstNode for SourceFile { fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } @@ -1675,8 +1675,8 @@ impl AstNode for Abi { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeParamList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } +impl AstNode for GenericParamList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3583,7 +3583,7 @@ impl std::fmt::Display for Abi { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeParamList { +impl std::fmt::Display for GenericParamList { 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/make.rs b/crates/ra_syntax/src/ast/make.rs index ef235680f..4759f23a5 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs @@ -291,7 +291,7 @@ pub fn visibility_pub_crate() -> ast::Visibility { pub fn fn_def( visibility: Option, fn_name: ast::Name, - type_params: Option, + type_params: Option, params: ast::ParamList, body: ast::BlockExpr, ) -> ast::Fn { diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 9fe0b93c1..113bd5d82 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs @@ -49,8 +49,8 @@ pub trait ModuleItemOwner: AstNode { } } -pub trait TypeParamsOwner: AstNode { - fn type_param_list(&self) -> Option { +pub trait GenericParamsOwner: AstNode { + fn generic_param_list(&self) -> Option { support::child(self.syntax()) } diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast index aca02ece4..10081a870 100644 --- a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..43 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "S" - TYPE_PARAM_LIST@8..11 + GENERIC_PARAM_LIST@8..11 L_ANGLE@8..9 "<" ERROR@9..11 INT_NUMBER@9..11 "90" diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast index c8bf96550..d62906b99 100644 --- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast +++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast @@ -10,7 +10,7 @@ SOURCE_FILE@0..389 WHITESPACE@13..14 NAME@14..21 IDENT@14..21 "process" - TYPE_PARAM_LIST@21..38 + GENERIC_PARAM_LIST@21..38 L_ANGLE@21..22 LIFETIME_PARAM@22..24 LIFETIME@22..24 "'a" diff --git a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast index 1ab045a44..a1f39b22a 100644 --- a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast +++ b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..23 WHITESPACE@2..3 " " NAME@3..6 IDENT@3..6 "foo" - TYPE_PARAM_LIST@6..9 + GENERIC_PARAM_LIST@6..9 L_ANGLE@6..7 "<" TYPE_PARAM@7..8 NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast index 1e94e72bc..4c2d1ad68 100644 --- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..240 WHITESPACE@2..3 " " NAME@3..4 IDENT@3..4 "f" - TYPE_PARAM_LIST@4..48 + GENERIC_PARAM_LIST@4..48 L_ANGLE@4..5 "<" TYPE_PARAM@5..47 NAME@5..6 @@ -39,7 +39,7 @@ SOURCE_FILE@0..240 L_PAREN@28..29 "(" FOR_TYPE@29..46 FOR_KW@29..32 "for" - TYPE_PARAM_LIST@32..36 + GENERIC_PARAM_LIST@32..36 L_ANGLE@32..33 "<" LIFETIME_PARAM@33..35 LIFETIME@33..35 "\'a" @@ -122,7 +122,7 @@ SOURCE_FILE@0..240 L_PAREN@102..103 "(" FOR_TYPE@103..120 FOR_KW@103..106 "for" - TYPE_PARAM_LIST@106..110 + GENERIC_PARAM_LIST@106..110 L_ANGLE@106..107 "<" LIFETIME_PARAM@107..109 LIFETIME@107..109 "\'a" @@ -242,7 +242,7 @@ SOURCE_FILE@0..240 L_PAREN@196..197 "(" FOR_TYPE@197..214 FOR_KW@197..200 "for" - TYPE_PARAM_LIST@200..204 + GENERIC_PARAM_LIST@200..204 L_ANGLE@200..201 "<" LIFETIME_PARAM@201..203 LIFETIME@201..203 "\'a" diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast index 254ff546a..8c8bf7b7e 100644 --- a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast @@ -1,7 +1,7 @@ SOURCE_FILE@0..38 IMPL_DEF@0..14 IMPL_KW@0..4 "impl" - TYPE_PARAM_LIST@4..14 + GENERIC_PARAM_LIST@4..14 L_ANGLE@4..5 "<" TYPE_PARAM@5..13 NAME@5..6 @@ -19,7 +19,7 @@ SOURCE_FILE@0..38 WHITESPACE@14..15 "\n" IMPL_DEF@15..37 IMPL_KW@15..19 "impl" - TYPE_PARAM_LIST@19..22 + GENERIC_PARAM_LIST@19..22 L_ANGLE@19..20 "<" TYPE_PARAM@20..21 NAME@20..21 diff --git a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast index 53704f640..a8e42e6ea 100644 --- a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast +++ b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast @@ -13,7 +13,7 @@ SOURCE_FILE@0..30 WHITESPACE@18..19 " " WHERE_PRED@19..26 FOR_KW@19..22 "for" - TYPE_PARAM_LIST@22..26 + GENERIC_PARAM_LIST@22..26 L_ANGLE@22..23 "<" LIFETIME_PARAM@23..25 LIFETIME@23..25 "\'a" 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 19b3540e9..082625c13 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 @@ -9,7 +9,7 @@ SOURCE_FILE@0..239 WHITESPACE@13..14 " " FOR_TYPE@14..29 FOR_KW@14..17 "for" - TYPE_PARAM_LIST@17..21 + GENERIC_PARAM_LIST@17..21 L_ANGLE@17..18 "<" LIFETIME_PARAM@18..20 LIFETIME@18..20 "\'a" @@ -36,7 +36,7 @@ SOURCE_FILE@0..239 WHITESPACE@44..45 " " FOR_TYPE@45..63 FOR_KW@45..48 "for" - TYPE_PARAM_LIST@48..52 + GENERIC_PARAM_LIST@48..52 L_ANGLE@48..49 "<" LIFETIME_PARAM@49..51 LIFETIME@49..51 "\'a" @@ -67,7 +67,7 @@ SOURCE_FILE@0..239 WHITESPACE@80..81 " " FOR_TYPE@81..94 FOR_KW@81..84 "for" - TYPE_PARAM_LIST@84..88 + GENERIC_PARAM_LIST@84..88 L_ANGLE@84..85 "<" LIFETIME_PARAM@85..87 LIFETIME@85..87 "\'a" @@ -93,7 +93,7 @@ SOURCE_FILE@0..239 WHITESPACE@111..112 " " FOR_TYPE@112..148 FOR_KW@112..115 "for" - TYPE_PARAM_LIST@115..119 + GENERIC_PARAM_LIST@115..119 L_ANGLE@115..116 "<" LIFETIME_PARAM@116..118 LIFETIME@116..118 "\'a" @@ -101,7 +101,7 @@ SOURCE_FILE@0..239 WHITESPACE@119..120 " " FOR_TYPE@120..148 FOR_KW@120..123 "for" - TYPE_PARAM_LIST@123..127 + GENERIC_PARAM_LIST@123..127 L_ANGLE@123..124 "<" LIFETIME_PARAM@124..126 LIFETIME@124..126 "\'b" @@ -141,7 +141,7 @@ SOURCE_FILE@0..239 WHITESPACE@152..153 " " NAME@153..164 IDENT@153..164 "for_for_for" - TYPE_PARAM_LIST@164..167 + GENERIC_PARAM_LIST@164..167 L_ANGLE@164..165 "<" TYPE_PARAM@165..166 NAME@165..166 @@ -156,7 +156,7 @@ SOURCE_FILE@0..239 WHITESPACE@175..180 "\n " WHERE_PRED@180..233 FOR_KW@180..183 "for" - TYPE_PARAM_LIST@183..187 + GENERIC_PARAM_LIST@183..187 L_ANGLE@183..184 "<" LIFETIME_PARAM@184..186 LIFETIME@184..186 "\'a" @@ -164,7 +164,7 @@ SOURCE_FILE@0..239 WHITESPACE@187..188 " " FOR_TYPE@188..227 FOR_KW@188..191 "for" - TYPE_PARAM_LIST@191..195 + GENERIC_PARAM_LIST@191..195 L_ANGLE@191..192 "<" LIFETIME_PARAM@192..194 LIFETIME@192..194 "\'b" @@ -172,7 +172,7 @@ SOURCE_FILE@0..239 WHITESPACE@195..196 " " FOR_TYPE@196..227 FOR_KW@196..199 "for" - TYPE_PARAM_LIST@199..203 + GENERIC_PARAM_LIST@199..203 L_ANGLE@199..200 "<" LIFETIME_PARAM@200..202 LIFETIME@200..202 "\'c" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast index 9cae1e8cc..b0f2b5888 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..54 WHITESPACE@2..3 " " NAME@3..12 IDENT@3..12 "for_trait" - TYPE_PARAM_LIST@12..15 + GENERIC_PARAM_LIST@12..15 L_ANGLE@12..13 "<" TYPE_PARAM@13..14 NAME@13..14 @@ -19,7 +19,7 @@ SOURCE_FILE@0..54 WHITESPACE@23..27 "\n " WHERE_PRED@27..49 FOR_KW@27..30 "for" - TYPE_PARAM_LIST@30..34 + GENERIC_PARAM_LIST@30..34 L_ANGLE@30..31 "<" LIFETIME_PARAM@31..33 LIFETIME@31..33 "\'a" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast index 1b56e20d5..8e0252ce7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..28 WHITESPACE@2..3 " " NAME@3..6 IDENT@3..6 "foo" - TYPE_PARAM_LIST@6..23 + GENERIC_PARAM_LIST@6..23 L_ANGLE@6..7 "<" TYPE_PARAM@7..22 NAME@7..8 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast index 7cb9e1d55..49aca06b0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..35 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "S" - TYPE_PARAM_LIST@8..33 + GENERIC_PARAM_LIST@8..33 L_ANGLE@8..9 "<" TYPE_PARAM@9..32 NAME@9..10 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast index 884ab2dbf..8f20ccaa3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..101 WHITESPACE@5..6 " " NAME@6..7 IDENT@6..7 "T" - TYPE_PARAM_LIST@7..10 + GENERIC_PARAM_LIST@7..10 L_ANGLE@7..8 "<" TYPE_PARAM@8..9 NAME@8..9 @@ -57,7 +57,7 @@ SOURCE_FILE@0..101 WHITESPACE@47..48 " " NAME@48..49 IDENT@48..49 "X" - TYPE_PARAM_LIST@49..69 + GENERIC_PARAM_LIST@49..69 L_ANGLE@49..50 "<" TYPE_PARAM@50..68 NAME@50..51 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast index fbf2e7c67..d4235a8b1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..35 WHITESPACE@2..3 " " NAME@3..6 IDENT@3..6 "foo" - TYPE_PARAM_LIST@6..30 + GENERIC_PARAM_LIST@6..30 L_ANGLE@6..7 "<" TYPE_PARAM@7..29 NAME@7..8 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 0123cb108..00cce69e6 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 @@ -4,7 +4,7 @@ SOURCE_FILE@0..21 WHITESPACE@4..5 " " NAME@5..11 IDENT@5..11 "Result" - TYPE_PARAM_LIST@11..14 + GENERIC_PARAM_LIST@11..14 L_ANGLE@11..12 "<" TYPE_PARAM@12..13 NAME@12..13 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast index cfa4c05f5..96217a7fd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..29 WHITESPACE@2..3 " " NAME@3..6 IDENT@3..6 "foo" - TYPE_PARAM_LIST@6..9 + GENERIC_PARAM_LIST@6..9 L_ANGLE@6..7 "<" TYPE_PARAM@7..8 NAME@7..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 175ec9844..e7629ac03 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 @@ -9,7 +9,7 @@ SOURCE_FILE@0..121 WHITESPACE@8..9 " " FOR_TYPE@9..27 FOR_KW@9..12 "for" - TYPE_PARAM_LIST@12..16 + GENERIC_PARAM_LIST@12..16 L_ANGLE@12..13 "<" LIFETIME_PARAM@13..15 LIFETIME@13..15 "\'a" @@ -39,7 +39,7 @@ SOURCE_FILE@0..121 WHITESPACE@37..38 " " FOR_TYPE@38..80 FOR_KW@38..41 "for" - TYPE_PARAM_LIST@41..45 + GENERIC_PARAM_LIST@41..45 L_ANGLE@41..42 "<" LIFETIME_PARAM@42..44 LIFETIME@42..44 "\'a" @@ -84,7 +84,7 @@ SOURCE_FILE@0..121 WHITESPACE@92..93 " " FOR_TYPE@93..119 FOR_KW@93..96 "for" - TYPE_PARAM_LIST@96..100 + GENERIC_PARAM_LIST@96..100 L_ANGLE@96..97 "<" LIFETIME_PARAM@97..99 LIFETIME@97..99 "\'a" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast index cee2bc906..1d24619c3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..19 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "S" - TYPE_PARAM_LIST@8..17 + GENERIC_PARAM_LIST@8..17 L_ANGLE@8..9 "<" TYPE_PARAM@9..16 NAME@9..10 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast index 01d717d6b..0b1ec5b27 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..53 WHITESPACE@6..7 " " NAME@7..11 IDENT@7..11 "Test" - TYPE_PARAM_LIST@11..14 + GENERIC_PARAM_LIST@11..14 L_ANGLE@11..12 "<" TYPE_PARAM@12..13 NAME@12..13 @@ -45,7 +45,7 @@ SOURCE_FILE@0..53 WHITESPACE@40..41 " " NAME@41..45 IDENT@41..45 "Test" - TYPE_PARAM_LIST@45..48 + GENERIC_PARAM_LIST@45..48 L_ANGLE@45..46 "<" TYPE_PARAM@46..47 NAME@46..47 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast index f4008cfdc..edac8d5d9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..64 WHITESPACE@2..3 " " NAME@3..6 IDENT@3..6 "foo" - TYPE_PARAM_LIST@6..49 + GENERIC_PARAM_LIST@6..49 L_ANGLE@6..7 "<" LIFETIME_PARAM@7..29 ATTR@7..26 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast index 1ad03e005..157513565 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..59 WHITESPACE@2..3 " " NAME@3..12 IDENT@3..12 "print_all" - TYPE_PARAM_LIST@12..40 + GENERIC_PARAM_LIST@12..40 L_ANGLE@12..13 "<" TYPE_PARAM@13..39 NAME@13..14 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast index 4b9b8e0ab..6981ef971 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..24 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "S" - TYPE_PARAM_LIST@8..22 + GENERIC_PARAM_LIST@8..22 L_ANGLE@8..9 "<" CONST_PARAM@9..21 CONST_KW@9..14 "const" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast index 77e12cad6..07e555d63 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast @@ -1,7 +1,7 @@ SOURCE_FILE@0..29 IMPL_DEF@0..28 IMPL_KW@0..4 "impl" - TYPE_PARAM_LIST@4..18 + GENERIC_PARAM_LIST@4..18 L_ANGLE@4..5 "<" CONST_PARAM@5..17 CONST_KW@5..10 "const" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast index 48d73a4e7..e2a770a37 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..83 WHITESPACE@5..6 " " NAME@6..7 IDENT@6..7 "Z" - TYPE_PARAM_LIST@7..10 + GENERIC_PARAM_LIST@7..10 L_ANGLE@7..8 "<" TYPE_PARAM@8..9 NAME@8..9 @@ -36,7 +36,7 @@ SOURCE_FILE@0..83 WHITESPACE@24..25 " " NAME@25..26 IDENT@25..26 "Z" - TYPE_PARAM_LIST@26..29 + GENERIC_PARAM_LIST@26..29 L_ANGLE@26..27 "<" TYPE_PARAM@27..28 NAME@27..28 @@ -87,7 +87,7 @@ SOURCE_FILE@0..83 WHITESPACE@57..58 " " NAME@58..59 IDENT@58..59 "Z" - TYPE_PARAM_LIST@59..62 + GENERIC_PARAM_LIST@59..62 L_ANGLE@59..60 "<" TYPE_PARAM@60..61 NAME@60..61 diff --git a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast index 705f7e001..cf801aedd 100644 --- a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..32 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "S" - TYPE_PARAM_LIST@8..17 + GENERIC_PARAM_LIST@8..17 L_ANGLE@8..9 "<" TYPE_PARAM@9..16 NAME@9..10 diff --git a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast index 451634e3f..3ee208fff 100644 --- a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast +++ b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..290 WHITESPACE@6..7 " " NAME@7..9 IDENT@7..9 "S1" - TYPE_PARAM_LIST@9..12 + GENERIC_PARAM_LIST@9..12 L_ANGLE@9..10 "<" TYPE_PARAM@10..11 NAME@10..11 @@ -17,7 +17,7 @@ SOURCE_FILE@0..290 WHITESPACE@20..21 " " NAME@21..23 IDENT@21..23 "S2" - TYPE_PARAM_LIST@23..26 + GENERIC_PARAM_LIST@23..26 L_ANGLE@23..24 "<" TYPE_PARAM@24..25 NAME@24..25 @@ -39,7 +39,7 @@ SOURCE_FILE@0..290 WHITESPACE@39..40 " " NAME@40..42 IDENT@40..42 "S3" - TYPE_PARAM_LIST@42..45 + GENERIC_PARAM_LIST@42..45 L_ANGLE@42..43 "<" TYPE_PARAM@43..44 NAME@43..44 @@ -67,7 +67,7 @@ SOURCE_FILE@0..290 WHITESPACE@64..65 " " NAME@65..67 IDENT@65..67 "S4" - TYPE_PARAM_LIST@67..69 + GENERIC_PARAM_LIST@67..69 L_ANGLE@67..68 "<" R_ANGLE@68..69 ">" SEMICOLON@69..70 ";" @@ -77,7 +77,7 @@ SOURCE_FILE@0..290 WHITESPACE@77..78 " " NAME@78..80 IDENT@78..80 "S5" - TYPE_PARAM_LIST@80..84 + GENERIC_PARAM_LIST@80..84 L_ANGLE@80..81 "<" LIFETIME_PARAM@81..83 LIFETIME@81..83 "\'a" @@ -89,7 +89,7 @@ SOURCE_FILE@0..290 WHITESPACE@92..93 " " NAME@93..95 IDENT@93..95 "S6" - TYPE_PARAM_LIST@95..100 + GENERIC_PARAM_LIST@95..100 L_ANGLE@95..96 "<" LIFETIME_PARAM@96..99 LIFETIME@96..98 "\'a" @@ -102,7 +102,7 @@ SOURCE_FILE@0..290 WHITESPACE@108..109 " " NAME@109..111 IDENT@109..111 "S7" - TYPE_PARAM_LIST@111..119 + GENERIC_PARAM_LIST@111..119 L_ANGLE@111..112 "<" LIFETIME_PARAM@112..118 LIFETIME@112..114 "\'a" @@ -117,7 +117,7 @@ SOURCE_FILE@0..290 WHITESPACE@127..128 " " NAME@128..130 IDENT@128..130 "S8" - TYPE_PARAM_LIST@130..141 + GENERIC_PARAM_LIST@130..141 L_ANGLE@130..131 "<" LIFETIME_PARAM@131..139 LIFETIME@131..133 "\'a" @@ -135,7 +135,7 @@ SOURCE_FILE@0..290 WHITESPACE@149..150 " " NAME@150..152 IDENT@150..152 "S9" - TYPE_PARAM_LIST@152..165 + GENERIC_PARAM_LIST@152..165 L_ANGLE@152..153 "<" LIFETIME_PARAM@153..164 LIFETIME@153..155 "\'a" @@ -154,7 +154,7 @@ SOURCE_FILE@0..290 WHITESPACE@173..174 " " NAME@174..177 IDENT@174..177 "S10" - TYPE_PARAM_LIST@177..182 + GENERIC_PARAM_LIST@177..182 L_ANGLE@177..178 "<" LIFETIME_PARAM@178..180 LIFETIME@178..180 "\'a" @@ -167,7 +167,7 @@ SOURCE_FILE@0..290 WHITESPACE@190..191 " " NAME@191..194 IDENT@191..194 "S11" - TYPE_PARAM_LIST@194..202 + GENERIC_PARAM_LIST@194..202 L_ANGLE@194..195 "<" LIFETIME_PARAM@195..197 LIFETIME@195..197 "\'a" @@ -183,7 +183,7 @@ SOURCE_FILE@0..290 WHITESPACE@210..211 " " NAME@211..214 IDENT@211..214 "S12" - TYPE_PARAM_LIST@214..232 + GENERIC_PARAM_LIST@214..232 L_ANGLE@214..215 "<" LIFETIME_PARAM@215..222 LIFETIME@215..217 "\'a" @@ -207,7 +207,7 @@ SOURCE_FILE@0..290 WHITESPACE@241..242 " " NAME@242..245 IDENT@242..245 "S13" - TYPE_PARAM_LIST@245..248 + GENERIC_PARAM_LIST@245..248 L_ANGLE@245..246 "<" TYPE_PARAM@246..247 NAME@246..247 @@ -220,7 +220,7 @@ SOURCE_FILE@0..290 WHITESPACE@256..257 " " NAME@257..260 IDENT@257..260 "S14" - TYPE_PARAM_LIST@260..266 + GENERIC_PARAM_LIST@260..266 L_ANGLE@260..261 "<" TYPE_PARAM@261..262 NAME@261..262 @@ -238,7 +238,7 @@ SOURCE_FILE@0..290 WHITESPACE@274..275 " " NAME@275..278 IDENT@275..278 "S15" - TYPE_PARAM_LIST@278..288 + GENERIC_PARAM_LIST@278..288 L_ANGLE@278..279 "<" LIFETIME_PARAM@279..281 LIFETIME@279..281 "\'a" 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 f767e9e19..993f28c4d 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast @@ -15,7 +15,7 @@ SOURCE_FILE@0..182 WHITESPACE@17..18 " " NAME@18..20 IDENT@18..20 "E2" - TYPE_PARAM_LIST@20..23 + GENERIC_PARAM_LIST@20..23 L_ANGLE@20..21 "<" TYPE_PARAM@21..22 NAME@21..22 diff --git a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast index 4fb4baf56..5100e6a48 100644 --- a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..250 WHITESPACE@6..7 " " NAME@7..8 IDENT@7..8 "A" - TYPE_PARAM_LIST@8..11 + GENERIC_PARAM_LIST@8..11 L_ANGLE@8..9 "<" TYPE_PARAM@9..10 NAME@9..10 @@ -17,7 +17,7 @@ SOURCE_FILE@0..250 WHITESPACE@19..20 " " NAME@20..21 IDENT@20..21 "B" - TYPE_PARAM_LIST@21..25 + GENERIC_PARAM_LIST@21..25 L_ANGLE@21..22 "<" TYPE_PARAM@22..24 NAME@22..23 @@ -32,7 +32,7 @@ SOURCE_FILE@0..250 WHITESPACE@33..34 " " NAME@34..35 IDENT@34..35 "C" - TYPE_PARAM_LIST@35..42 + GENERIC_PARAM_LIST@35..42 L_ANGLE@35..36 "<" TYPE_PARAM@36..41 NAME@36..37 @@ -50,7 +50,7 @@ SOURCE_FILE@0..250 WHITESPACE@50..51 " " NAME@51..52 IDENT@51..52 "D" - TYPE_PARAM_LIST@52..62 + GENERIC_PARAM_LIST@52..62 L_ANGLE@52..53 "<" TYPE_PARAM@53..60 NAME@53..54 @@ -71,7 +71,7 @@ SOURCE_FILE@0..250 WHITESPACE@70..71 " " NAME@71..72 IDENT@71..72 "E" - TYPE_PARAM_LIST@72..85 + GENERIC_PARAM_LIST@72..85 L_ANGLE@72..73 "<" TYPE_PARAM@73..83 NAME@73..74 @@ -95,7 +95,7 @@ SOURCE_FILE@0..250 WHITESPACE@93..94 " " NAME@94..95 IDENT@94..95 "F" - TYPE_PARAM_LIST@95..115 + GENERIC_PARAM_LIST@95..115 L_ANGLE@95..96 "<" TYPE_PARAM@96..114 NAME@96..97 @@ -127,7 +127,7 @@ SOURCE_FILE@0..250 WHITESPACE@123..124 " " NAME@124..125 IDENT@124..125 "G" - TYPE_PARAM_LIST@125..142 + GENERIC_PARAM_LIST@125..142 L_ANGLE@125..126 "<" TYPE_PARAM@126..141 NAME@126..127 @@ -158,7 +158,7 @@ SOURCE_FILE@0..250 WHITESPACE@150..151 " " NAME@151..152 IDENT@151..152 "H" - TYPE_PARAM_LIST@152..179 + GENERIC_PARAM_LIST@152..179 L_ANGLE@152..153 "<" TYPE_PARAM@153..178 NAME@153..154 @@ -199,7 +199,7 @@ SOURCE_FILE@0..250 WHITESPACE@187..188 " " NAME@188..189 IDENT@188..189 "I" - TYPE_PARAM_LIST@189..198 + GENERIC_PARAM_LIST@189..198 L_ANGLE@189..190 "<" TYPE_PARAM@190..192 NAME@190..191 @@ -222,7 +222,7 @@ SOURCE_FILE@0..250 WHITESPACE@206..207 " " NAME@207..208 IDENT@207..208 "K" - TYPE_PARAM_LIST@208..249 + GENERIC_PARAM_LIST@208..249 L_ANGLE@208..209 "<" LIFETIME_PARAM@209..215 LIFETIME@209..211 "\'a" diff --git a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast index 1b2325a2d..10da87c71 100644 --- a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast +++ b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..116 WHITESPACE@2..3 " " NAME@3..21 IDENT@3..21 "test_serialization" - TYPE_PARAM_LIST@21..26 + GENERIC_PARAM_LIST@21..26 L_ANGLE@21..22 "<" TYPE_PARAM@22..25 NAME@22..25 @@ -38,7 +38,7 @@ SOURCE_FILE@0..116 TYPE_BOUND@56..81 FOR_TYPE@56..81 FOR_KW@56..59 "for" - TYPE_PARAM_LIST@59..64 + GENERIC_PARAM_LIST@59..64 L_ANGLE@59..60 "<" LIFETIME_PARAM@60..63 LIFETIME@60..63 "\'de" diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index 2e36b54bc..ea54651b7 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast @@ -1565,7 +1565,7 @@ SOURCE_FILE@0..3813 WHITESPACE@2856..2857 " " NAME@2857..2862 IDENT@2857..2862 "union" - TYPE_PARAM_LIST@2862..2870 + GENERIC_PARAM_LIST@2862..2870 L_ANGLE@2862..2863 "<" LIFETIME_PARAM@2863..2869 LIFETIME@2863..2869 "\'union" diff --git a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast index a5f09e364..c4da317b9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast +++ b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast @@ -9,7 +9,7 @@ SOURCE_FILE@0..157 WHITESPACE@68..69 " " NAME@69..72 IDENT@69..72 "foo" - TYPE_PARAM_LIST@72..85 + GENERIC_PARAM_LIST@72..85 L_ANGLE@72..73 "<" TYPE_PARAM@73..84 NAME@73..74 diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast index 9a173b002..8081eefbc 100644 --- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast @@ -137,7 +137,7 @@ SOURCE_FILE@0..519 WHITESPACE@132..133 " " NAME@133..136 IDENT@133..136 "foo" - TYPE_PARAM_LIST@136..168 + GENERIC_PARAM_LIST@136..168 L_ANGLE@136..137 "<" TYPE_PARAM@137..167 NAME@137..138 @@ -341,7 +341,7 @@ SOURCE_FILE@0..519 WHITESPACE@342..343 " " NAME@343..345 IDENT@343..345 "g3" - TYPE_PARAM_LIST@345..349 + GENERIC_PARAM_LIST@345..349 L_ANGLE@345..346 "<" LIFETIME_PARAM@346..348 LIFETIME@346..348 "\'a" @@ -373,7 +373,7 @@ SOURCE_FILE@0..519 WHITESPACE@379..380 " " NAME@380..382 IDENT@380..382 "g4" - TYPE_PARAM_LIST@382..386 + GENERIC_PARAM_LIST@382..386 L_ANGLE@382..383 "<" LIFETIME_PARAM@383..385 LIFETIME@383..385 "\'a" @@ -405,7 +405,7 @@ SOURCE_FILE@0..519 WHITESPACE@415..416 " " NAME@416..418 IDENT@416..418 "g5" - TYPE_PARAM_LIST@418..422 + GENERIC_PARAM_LIST@418..422 L_ANGLE@418..419 "<" LIFETIME_PARAM@419..421 LIFETIME@419..421 "\'a" diff --git a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast index 7996dc121..2c699ffcb 100644 --- a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast +++ b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..40 WHITESPACE@2..3 " " NAME@3..4 IDENT@3..4 "f" - TYPE_PARAM_LIST@4..7 + GENERIC_PARAM_LIST@4..7 L_ANGLE@4..5 "<" TYPE_PARAM@5..6 NAME@5..6 diff --git a/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast b/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast index e4c2578f6..a368ac1e8 100644 --- a/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast +++ b/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast @@ -4,7 +4,7 @@ SOURCE_FILE@0..374 WHITESPACE@2..3 " " NAME@3..12 IDENT@3..12 "for_trait" - TYPE_PARAM_LIST@12..15 + GENERIC_PARAM_LIST@12..15 L_ANGLE@12..13 "<" TYPE_PARAM@13..14 NAME@13..14 @@ -19,7 +19,7 @@ SOURCE_FILE@0..374 WHITESPACE@23..28 "\n " WHERE_PRED@28..50 FOR_KW@28..31 "for" - TYPE_PARAM_LIST@31..35 + GENERIC_PARAM_LIST@31..35 L_ANGLE@31..32 "<" LIFETIME_PARAM@32..34 LIFETIME@32..34 "\'a" @@ -64,7 +64,7 @@ SOURCE_FILE@0..374 WHITESPACE@58..59 " " NAME@59..66 IDENT@59..66 "for_ref" - TYPE_PARAM_LIST@66..69 + GENERIC_PARAM_LIST@66..69 L_ANGLE@66..67 "<" TYPE_PARAM@67..68 NAME@67..68 @@ -79,7 +79,7 @@ SOURCE_FILE@0..374 WHITESPACE@77..82 "\n " WHERE_PRED@82..102 FOR_KW@82..85 "for" - TYPE_PARAM_LIST@85..89 + GENERIC_PARAM_LIST@85..89 L_ANGLE@85..86 "<" LIFETIME_PARAM@86..88 LIFETIME@86..88 "\'a" @@ -115,7 +115,7 @@ SOURCE_FILE@0..374 WHITESPACE@110..111 " " NAME@111..121 IDENT@111..121 "for_parens" - TYPE_PARAM_LIST@121..124 + GENERIC_PARAM_LIST@121..124 L_ANGLE@121..122 "<" TYPE_PARAM@122..123 NAME@122..123 @@ -130,7 +130,7 @@ SOURCE_FILE@0..374 WHITESPACE@132..137 "\n " WHERE_PRED@137..165 FOR_KW@137..140 "for" - TYPE_PARAM_LIST@140..144 + GENERIC_PARAM_LIST@140..144 L_ANGLE@140..141 "<" LIFETIME_PARAM@141..143 LIFETIME@141..143 "\'a" @@ -182,7 +182,7 @@ SOURCE_FILE@0..374 WHITESPACE@173..174 " " NAME@174..183 IDENT@174..183 "for_slice" - TYPE_PARAM_LIST@183..186 + GENERIC_PARAM_LIST@183..186 L_ANGLE@183..184 "<" TYPE_PARAM@184..185 NAME@184..185 @@ -197,7 +197,7 @@ SOURCE_FILE@0..374 WHITESPACE@194..199 "\n " WHERE_PRED@199..218 FOR_KW@199..202 "for" - TYPE_PARAM_LIST@202..206 + GENERIC_PARAM_LIST@202..206 L_ANGLE@202..203 "<" LIFETIME_PARAM@203..205 LIFETIME@203..205 "\'a" @@ -236,7 +236,7 @@ SOURCE_FILE@0..374 WHITESPACE@226..227 " " NAME@227..236 IDENT@227..236 "for_qpath" - TYPE_PARAM_LIST@236..239 + GENERIC_PARAM_LIST@236..239 L_ANGLE@236..237 "<" TYPE_PARAM@237..238 NAME@237..238 @@ -264,7 +264,7 @@ SOURCE_FILE@0..374 WHITESPACE@253..258 "\n " WHERE_PRED@258..295 FOR_KW@258..261 "for" - TYPE_PARAM_LIST@261..265 + GENERIC_PARAM_LIST@261..265 L_ANGLE@261..262 "<" LIFETIME_PARAM@262..264 LIFETIME@262..264 "\'a" @@ -318,7 +318,7 @@ SOURCE_FILE@0..374 WHITESPACE@303..304 " " NAME@304..314 IDENT@304..314 "for_for_fn" - TYPE_PARAM_LIST@314..317 + GENERIC_PARAM_LIST@314..317 L_ANGLE@314..315 "<" TYPE_PARAM@315..316 NAME@315..316 @@ -333,7 +333,7 @@ SOURCE_FILE@0..374 WHITESPACE@325..330 "\n " WHERE_PRED@330..368 FOR_KW@330..333 "for" - TYPE_PARAM_LIST@333..337 + GENERIC_PARAM_LIST@333..337 L_ANGLE@333..334 "<" LIFETIME_PARAM@334..336 LIFETIME@334..336 "\'a" @@ -341,7 +341,7 @@ SOURCE_FILE@0..374 WHITESPACE@337..338 " " FOR_TYPE@338..362 FOR_KW@338..341 "for" - TYPE_PARAM_LIST@341..345 + GENERIC_PARAM_LIST@341..345 L_ANGLE@341..342 "<" LIFETIME_PARAM@342..344 LIFETIME@342..344 "\'b" diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index e66e96d64..b81985851 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -203,7 +203,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "NAME_REF", "LET_STMT", "EXPR_STMT", - "TYPE_PARAM_LIST", + "GENERIC_PARAM_LIST", "LIFETIME_PARAM", "TYPE_PARAM", "CONST_PARAM", diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index 072527208..f79cd972e 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -667,7 +667,7 @@ fn extract_struct_traits(ast: &mut AstSrc) { ("AttrsOwner", &["attrs"]), ("NameOwner", &["name"]), ("VisibilityOwner", &["visibility"]), - ("TypeParamsOwner", &["type_param_list", "where_clause"]), + ("GenericParamsOwner", &["generic_param_list", "where_clause"]), ("TypeBoundsOwner", &["type_bound_list", "colon_token"]), ("ModuleItemOwner", &["items"]), ("TypeAscriptionOwner", &["ascribed_type"]), diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 760a8dd95..833ffd9e0 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -45,7 +45,7 @@ UseTreeList = Fn = Attr* Visibility? 'default'? ('async' | 'const')? 'unsafe'? Abi? - 'fn' Name TypeParamList? ParamList RetType? + 'fn' Name GenericParamList? ParamList RetType? WhereClause? (body:BlockExpr | ';') @@ -73,17 +73,17 @@ RetType = '->' TypeRef TypeAlias = - Attr* Visibility? 'default'? 'type' Name TypeParamList? (':' TypeBoundList?)? WhereClause? + Attr* Visibility? 'default'? 'type' Name GenericParamList? (':' TypeBoundList?)? WhereClause? '=' TypeRef ';' StructDef = - Attr* Visibility? 'struct' Name TypeParamList? ( + Attr* Visibility? 'struct' Name GenericParamList? ( WhereClause? (RecordFieldDefList | ';') | TupleFieldDefList WhereClause? ';' ) UnionDef = - Attr* Visibility? 'union' Name TypeParamList? WhereClause? + Attr* Visibility? 'union' Name GenericParamList? WhereClause? RecordFieldDefList RecordFieldDefList = @@ -103,7 +103,7 @@ FieldDefList = | TupleFieldDefList EnumDef = - Attr* Visibility? 'enum' Name TypeParamList? WhereClause? + Attr* Visibility? 'enum' Name GenericParamList? WhereClause? variant_list:EnumVariantList EnumVariantList = @@ -113,7 +113,7 @@ EnumVariant = Attr* Visibility? Name FieldDefList ('=' Expr)? TraitDef = - Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList + Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList (':' TypeBoundList?)? WhereClause AssocItemList @@ -129,7 +129,7 @@ StaticDef = '=' body:Expr ';' ImplDef = - Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' + Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' GenericParamList? '!'? 'for' WhereClause? AssocItemList @@ -164,7 +164,7 @@ FnPointerType = Abi 'unsafe'? 'fn' ParamList RetType? ForType = - 'for' TypeParamList TypeRef + 'for' GenericParamList TypeRef ImplTraitType = 'impl' TypeBoundList @@ -379,7 +379,7 @@ MacroStmts = Attr = '#' '!'? '[' Path ('=' input:AttrInput)? ']' -TypeParamList = +GenericParamList = '<' TypeParam* LifetimeParam* @@ -404,7 +404,7 @@ TypeBoundList = bounds:TypeBound* WherePred = - ('for' TypeParamList)? ('lifetime' | TypeRef) ':' TypeBoundList + ('for' GenericParamList)? ('lifetime' | TypeRef) ':' TypeBoundList WhereClause = 'where' predicates:WherePred* -- cgit v1.2.3