From 91781c7ce8201b28afd56b4e35eba47e076a8498 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 31 Jul 2020 18:29:29 +0200 Subject: [PATCH] Rename TypeArgList -> GenericArgList --- crates/ra_assists/src/ast_transform.rs | 4 ++-- crates/ra_hir_def/src/body/lower.rs | 2 +- crates/ra_hir_def/src/path.rs | 2 +- crates/ra_hir_def/src/path/lower.rs | 4 ++-- crates/ra_ide/src/completion/completion_context.rs | 2 +- crates/ra_ide/src/extend_selection.rs | 2 +- crates/ra_parser/src/grammar/type_args.rs | 2 +- crates/ra_parser/src/syntax_kind/generated.rs | 2 +- crates/ra_ssr/src/matching.rs | 4 ++-- crates/ra_ssr/src/resolving.rs | 2 +- crates/ra_syntax/src/ast/edit.rs | 8 ++++---- crates/ra_syntax/src/ast/generated/nodes.rs | 14 +++++++------- .../test_data/parser/err/0012_broken_lambda.rast | 4 ++-- .../test_data/parser/err/0013_invalid_type.rast | 6 +++--- .../parser/err/0024_many_type_parens.rast | 12 ++++++------ .../test_data/parser/err/0026_imp_recovery.rast | 2 +- .../test_data/parser/err/0039_lambda_recovery.rast | 2 +- .../parser/fragments/type/ok/0000_result.rast | 2 +- .../ok/0004_value_parameters_no_patterns.rast | 2 +- .../parser/inline/ok/0018_arb_self_types.rast | 2 +- .../parser/inline/ok/0028_impl_trait_type.rast | 4 ++-- .../test_data/parser/inline/ok/0039_type_arg.rast | 2 +- .../inline/ok/0045_param_list_opt_patterns.rast | 2 +- .../inline/ok/0048_path_type_with_bounds.rast | 4 ++-- .../test_data/parser/inline/ok/0053_path_expr.rast | 2 +- .../parser/inline/ok/0065_dyn_trait_type.rast | 4 ++-- .../test_data/parser/inline/ok/0081_for_type.rast | 2 +- .../parser/inline/ok/0104_path_fn_trait_args.rast | 2 +- .../parser/inline/ok/0107_method_call_expr.rast | 2 +- .../inline/ok/0138_associated_type_bounds.rast | 2 +- .../parser/inline/ok/0150_impl_type_params.rast | 2 +- .../parser/inline/ok/0151_trait_alias.rast | 6 +++--- .../test_data/parser/ok/0032_where_for.rast | 2 +- .../test_data/parser/ok/0035_weird_exprs.rast | 4 ++-- .../parser/ok/0045_block_inner_attrs.rast | 2 +- .../parser/ok/0050_async_block_as_argument.rast | 2 +- .../test_data/parser/ok/0051_parameter_attrs.rast | 4 ++-- .../test_data/parser/ok/0052_for_range_block.rast | 2 +- .../parser/ok/0054_qual_path_in_type_arg.rast | 2 +- xtask/src/ast_src.rs | 2 +- xtask/src/codegen/rust.ungram | 6 +++--- 41 files changed, 70 insertions(+), 70 deletions(-) diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 3265bd4069..e233317736 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -86,7 +86,7 @@ impl<'a> SubstituteTypeParams<'a> { ast::Type::PathType(path) => path, _ => return None, }; - let type_arg_list = path_type.path()?.segment()?.type_arg_list()?; + let type_arg_list = path_type.path()?.segment()?.generic_arg_list()?; let mut result = Vec::new(); for type_arg in type_arg_list.type_args() { let type_arg: ast::TypeArg = type_arg; @@ -157,7 +157,7 @@ impl<'a> QualifyPaths<'a> { let type_args = p .segment() - .and_then(|s| s.type_arg_list()) + .and_then(|s| s.generic_arg_list()) .map(|arg_list| apply(self, arg_list)); if let Some(type_args) = type_args { let last_segment = path.segment().unwrap(); diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 0cacc63efb..6bedc6b564 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs @@ -337,7 +337,7 @@ impl ExprCollector<'_> { }; let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing); let generic_args = - e.type_arg_list().and_then(|it| GenericArgs::from_ast(&self.ctx(), it)); + e.generic_arg_list().and_then(|it| GenericArgs::from_ast(&self.ctx(), it)); self.alloc_expr( Expr::MethodCall { receiver, method_name, args, generic_args }, syntax_ptr, diff --git a/crates/ra_hir_def/src/path.rs b/crates/ra_hir_def/src/path.rs index 68b9f89c37..cc1726e9e0 100644 --- a/crates/ra_hir_def/src/path.rs +++ b/crates/ra_hir_def/src/path.rs @@ -258,7 +258,7 @@ impl<'a> PathSegments<'a> { } impl GenericArgs { - pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::TypeArgList) -> Option { + pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::GenericArgList) -> Option { lower::lower_generic_args(lower_ctx, node) } diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index 257f9a033c..aefeca4008 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs @@ -41,7 +41,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option match hygiene.name_ref_to_name(name_ref) { Either::Left(name) => { let args = segment - .type_arg_list() + .generic_arg_list() .and_then(|it| lower_generic_args(&ctx, it)) .or_else(|| { lower_generic_args_from_fn_path( @@ -148,7 +148,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option pub(super) fn lower_generic_args( lower_ctx: &LowerCtx, - node: ast::TypeArgList, + node: ast::GenericArgList, ) -> Option { let mut args = Vec::new(); for type_arg in node.type_args() { diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 2113abbb22..2a5f3c3d20 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -377,7 +377,7 @@ impl<'a> CompletionContext<'a> { path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some(); self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); - self.has_type_args = segment.type_arg_list().is_some(); + self.has_type_args = segment.generic_arg_list().is_some(); #[allow(deprecated)] if let Some(path) = hir::Path::from_ast(path.clone()) { diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index fc81b48cce..319fd500d9 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs @@ -45,7 +45,7 @@ fn try_extend_selection( VARIANT_LIST, USE_TREE_LIST, GENERIC_PARAM_LIST, - TYPE_ARG_LIST, + GENERIC_ARG_LIST, TYPE_BOUND_LIST, PARAM_LIST, ARG_LIST, diff --git a/crates/ra_parser/src/grammar/type_args.rs b/crates/ra_parser/src/grammar/type_args.rs index 2d61f9d808..8f88d51db3 100644 --- a/crates/ra_parser/src/grammar/type_args.rs +++ b/crates/ra_parser/src/grammar/type_args.rs @@ -22,7 +22,7 @@ pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) { } } p.expect(T![>]); - m.complete(p, TYPE_ARG_LIST); + m.complete(p, GENERIC_ARG_LIST); } // test type_arg diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 2830c0d74b..c3670fb62c 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs @@ -235,7 +235,7 @@ pub enum SyntaxKind { LIFETIME_PARAM, TYPE_PARAM, CONST_PARAM, - TYPE_ARG_LIST, + GENERIC_ARG_LIST, LIFETIME_ARG, TYPE_ARG, ASSOC_TYPE_ARG, diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index 74e15c6317..0f72fea691 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs @@ -348,8 +348,8 @@ impl<'db, 'sema> Matcher<'db, 'sema> { // separately via comparing what the path resolves to below. self.attempt_match_opt( phase, - pattern_segment.type_arg_list(), - code_segment.type_arg_list(), + pattern_segment.generic_arg_list(), + code_segment.generic_arg_list(), )?; self.attempt_match_opt( phase, diff --git a/crates/ra_ssr/src/resolving.rs b/crates/ra_ssr/src/resolving.rs index 78d4565467..c2fd3b9050 100644 --- a/crates/ra_ssr/src/resolving.rs +++ b/crates/ra_ssr/src/resolving.rs @@ -217,7 +217,7 @@ fn pick_node_for_resolution(node: SyntaxNode) -> SyntaxNode { fn path_contains_type_arguments(path: Option) -> bool { if let Some(path) = path { if let Some(segment) = path.segment() { - if segment.type_arg_list().is_some() { + if segment.generic_arg_list().is_some() { mark::hit!(type_arguments_within_path); return true; } diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 8d3e42f256..04746ef8f4 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs @@ -237,17 +237,17 @@ impl ast::Path { impl ast::PathSegment { #[must_use] - pub fn with_type_args(&self, type_args: ast::TypeArgList) -> ast::PathSegment { + pub fn with_type_args(&self, type_args: ast::GenericArgList) -> ast::PathSegment { self._with_type_args(type_args, false) } #[must_use] - pub fn with_turbo_fish(&self, type_args: ast::TypeArgList) -> ast::PathSegment { + pub fn with_turbo_fish(&self, type_args: ast::GenericArgList) -> ast::PathSegment { self._with_type_args(type_args, true) } - fn _with_type_args(&self, type_args: ast::TypeArgList, turbo: bool) -> ast::PathSegment { - if let Some(old) = self.type_arg_list() { + fn _with_type_args(&self, type_args: ast::GenericArgList, turbo: bool) -> ast::PathSegment { + if let Some(old) = self.generic_arg_list() { return self.replace_children( single_node(old.syntax().clone()), iter::once(type_args.syntax().clone().into()), diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index 1a707ad678..903646149d 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs @@ -24,7 +24,7 @@ impl PathSegment { pub fn self_token(&self) -> Option { support::token(&self.syntax, T![self]) } pub fn super_token(&self) -> Option { support::token(&self.syntax, T![super]) } pub fn name_ref(&self) -> Option { support::child(&self.syntax) } - pub fn type_arg_list(&self) -> Option { support::child(&self.syntax) } + pub fn generic_arg_list(&self) -> Option { support::child(&self.syntax) } pub fn param_list(&self) -> Option { support::child(&self.syntax) } pub fn ret_type(&self) -> Option { support::child(&self.syntax) } pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } @@ -40,10 +40,10 @@ impl NameRef { pub fn ident_token(&self) -> Option { support::token(&self.syntax, T![ident]) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -pub struct TypeArgList { +pub struct GenericArgList { pub(crate) syntax: SyntaxNode, } -impl TypeArgList { +impl GenericArgList { pub fn coloncolon_token(&self) -> Option { support::token(&self.syntax, T![::]) } pub fn l_angle_token(&self) -> Option { support::token(&self.syntax, T![<]) } pub fn type_args(&self) -> AstChildren { support::children(&self.syntax) } @@ -803,7 +803,7 @@ impl MethodCallExpr { pub fn expr(&self) -> Option { support::child(&self.syntax) } pub fn dot_token(&self) -> Option { support::token(&self.syntax, T![.]) } pub fn name_ref(&self) -> Option { support::child(&self.syntax) } - pub fn type_arg_list(&self) -> Option { support::child(&self.syntax) } + pub fn generic_arg_list(&self) -> Option { support::child(&self.syntax) } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct ParenExpr { @@ -1434,8 +1434,8 @@ impl AstNode for NameRef { } fn syntax(&self) -> &SyntaxNode { &self.syntax } } -impl AstNode for TypeArgList { - fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ARG_LIST } +impl AstNode for GenericArgList { + fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_ARG_LIST } fn cast(syntax: SyntaxNode) -> Option { if Self::can_cast(syntax.kind()) { Some(Self { syntax }) @@ -3445,7 +3445,7 @@ impl std::fmt::Display for NameRef { std::fmt::Display::fmt(self.syntax(), f) } } -impl std::fmt::Display for TypeArgList { +impl std::fmt::Display for GenericArgList { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { std::fmt::Display::fmt(self.syntax(), f) } 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 0afa24b775..307d9b31b9 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 @@ -25,7 +25,7 @@ SOURCE_FILE@0..389 PATH_SEGMENT@29..37 NAME_REF@29..33 IDENT@29..33 "Sink" - TYPE_ARG_LIST@33..37 + GENERIC_ARG_LIST@33..37 L_ANGLE@33..34 LIFETIME_ARG@34..36 LIFETIME@34..36 "'a" @@ -79,7 +79,7 @@ SOURCE_FILE@0..389 PATH_SEGMENT@82..92 NAME_REF@82..85 IDENT@82..85 "Vec" - TYPE_ARG_LIST@85..92 + GENERIC_ARG_LIST@85..92 L_ANGLE@85..86 TYPE_ARG@86..91 PATH_TYPE@86..91 diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast index 3eef848fc8..f48ab6e712 100644 --- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast @@ -16,7 +16,7 @@ SOURCE_FILE@0..86 PATH_SEGMENT@22..68 NAME_REF@22..29 IDENT@22..29 "RefCell" - TYPE_ARG_LIST@29..68 + GENERIC_ARG_LIST@29..68 L_ANGLE@29..30 "<" TYPE_ARG@30..68 PATH_TYPE@30..68 @@ -24,7 +24,7 @@ SOURCE_FILE@0..86 PATH_SEGMENT@30..68 NAME_REF@30..37 IDENT@30..37 "HashMap" - TYPE_ARG_LIST@37..68 + GENERIC_ARG_LIST@37..68 L_ANGLE@37..38 "<" WHITESPACE@38..47 "\n " TYPE_ARG@47..53 @@ -41,7 +41,7 @@ SOURCE_FILE@0..86 PATH_SEGMENT@63..68 NAME_REF@63..66 IDENT@63..66 "Box" - TYPE_ARG_LIST@66..68 + GENERIC_ARG_LIST@66..68 L_ANGLE@66..67 "<" TYPE_ARG@67..68 ERROR@67..68 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 4c2d1ad686..1cb1e97574 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 @@ -50,7 +50,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@37..46 NAME_REF@37..42 IDENT@37..42 "Trait" - TYPE_ARG_LIST@42..46 + GENERIC_ARG_LIST@42..46 L_ANGLE@42..43 "<" LIFETIME_ARG@43..45 LIFETIME@43..45 "\'a" @@ -92,7 +92,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@78..88 NAME_REF@78..81 IDENT@78..81 "Box" - TYPE_ARG_LIST@81..88 + GENERIC_ARG_LIST@81..88 L_ANGLE@81..82 "<" TYPE_ARG@82..88 PAREN_TYPE@82..88 @@ -133,7 +133,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@111..120 NAME_REF@111..116 IDENT@111..116 "Trait" - TYPE_ARG_LIST@116..120 + GENERIC_ARG_LIST@116..120 L_ANGLE@116..117 "<" LIFETIME_ARG@117..119 LIFETIME@117..119 "\'a" @@ -156,7 +156,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@135..141 NAME_REF@135..138 IDENT@135..138 "Box" - TYPE_ARG_LIST@138..141 + GENERIC_ARG_LIST@138..141 L_ANGLE@138..139 "<" TYPE_ARG@139..141 PAREN_TYPE@139..141 @@ -235,7 +235,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@192..215 NAME_REF@192..195 IDENT@192..195 "Box" - TYPE_ARG_LIST@195..215 + GENERIC_ARG_LIST@195..215 L_ANGLE@195..196 "<" TYPE_ARG@196..215 PAREN_TYPE@196..215 @@ -253,7 +253,7 @@ SOURCE_FILE@0..240 PATH_SEGMENT@205..214 NAME_REF@205..210 IDENT@205..210 "Trait" - TYPE_ARG_LIST@210..214 + GENERIC_ARG_LIST@210..214 L_ANGLE@210..211 "<" LIFETIME_ARG@211..213 LIFETIME@211..213 "\'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 7e4b11c272..1b08c834eb 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 @@ -31,7 +31,7 @@ SOURCE_FILE@0..38 PATH_SEGMENT@23..34 NAME_REF@23..31 IDENT@23..31 "OnceCell" - TYPE_ARG_LIST@31..34 + GENERIC_ARG_LIST@31..34 L_ANGLE@31..32 "<" TYPE_ARG@32..33 PATH_TYPE@32..33 diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast index 0678d42781..7a5e115bc4 100644 --- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast @@ -62,7 +62,7 @@ SOURCE_FILE@0..83 DOT@66..67 "." NAME_REF@67..70 IDENT@67..70 "max" - TYPE_ARG_LIST@70..77 + GENERIC_ARG_LIST@70..77 COLON2@70..72 "::" L_ANGLE@72..73 "<" TYPE_ARG@73..76 diff --git a/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast b/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast index 8831cfa6c8..38c15b5815 100644 --- a/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast +++ b/crates/ra_syntax/test_data/parser/fragments/type/ok/0000_result.rast @@ -3,7 +3,7 @@ PATH_TYPE@0..16 PATH_SEGMENT@0..16 NAME_REF@0..6 IDENT@0..6 "Result" - TYPE_ARG_LIST@6..16 + GENERIC_ARG_LIST@6..16 L_ANGLE@6..7 "<" TYPE_ARG@7..10 PATH_TYPE@7..10 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 ace8ad050a..44d92aedbc 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 @@ -12,7 +12,7 @@ SOURCE_FILE@0..39 PATH_SEGMENT@9..37 NAME_REF@9..12 IDENT@9..12 "Box" - TYPE_ARG_LIST@12..37 + GENERIC_ARG_LIST@12..37 L_ANGLE@12..13 "<" TYPE_ARG@13..36 PATH_TYPE@13..36 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast index 20b2b6c193..1b31aa95a2 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast @@ -53,7 +53,7 @@ SOURCE_FILE@0..69 PATH_SEGMENT@53..62 NAME_REF@53..56 IDENT@53..56 "Box" - TYPE_ARG_LIST@56..62 + GENERIC_ARG_LIST@56..62 L_ANGLE@56..57 "<" TYPE_ARG@57..61 PATH_TYPE@57..61 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 f45f3cab89..32b2959bdf 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 @@ -17,7 +17,7 @@ SOURCE_FILE@0..43 PATH_SEGMENT@14..36 NAME_REF@14..22 IDENT@14..22 "Iterator" - TYPE_ARG_LIST@22..36 + GENERIC_ARG_LIST@22..36 L_ANGLE@22..23 "<" ASSOC_TYPE_ARG@23..35 NAME_REF@23..27 @@ -28,7 +28,7 @@ SOURCE_FILE@0..43 PATH_SEGMENT@28..35 NAME_REF@28..31 IDENT@28..31 "Foo" - TYPE_ARG_LIST@31..35 + GENERIC_ARG_LIST@31..35 L_ANGLE@31..32 "<" LIFETIME_ARG@32..34 LIFETIME@32..34 "\'a" 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 2185d3c915..b9381abdcb 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 @@ -12,7 +12,7 @@ SOURCE_FILE@0..46 PATH_SEGMENT@9..44 NAME_REF@9..10 IDENT@9..10 "B" - TYPE_ARG_LIST@10..44 + GENERIC_ARG_LIST@10..44 L_ANGLE@10..11 "<" LIFETIME_ARG@11..18 LIFETIME@11..18 "\'static" 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 d4235a8b1c..c100d1c713 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 @@ -30,7 +30,7 @@ SOURCE_FILE@0..35 PATH_SEGMENT@21..28 NAME_REF@21..24 IDENT@21..24 "Foo" - TYPE_ARG_LIST@24..28 + GENERIC_ARG_LIST@24..28 L_ANGLE@24..25 "<" LIFETIME_ARG@25..27 LIFETIME@25..27 "\'a" diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast index 37757ccd45..4d8404e7c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast @@ -16,7 +16,7 @@ SOURCE_FILE@0..58 PATH_SEGMENT@12..23 NAME_REF@12..15 IDENT@12..15 "Box" - TYPE_ARG_LIST@15..23 + GENERIC_ARG_LIST@15..23 L_ANGLE@15..16 "<" TYPE_ARG@16..22 DYN_TRAIT_TYPE@16..22 @@ -55,7 +55,7 @@ SOURCE_FILE@0..58 PATH_SEGMENT@39..54 NAME_REF@39..42 IDENT@39..42 "Box" - TYPE_ARG_LIST@42..54 + GENERIC_ARG_LIST@42..54 L_ANGLE@42..43 "<" TYPE_ARG@43..53 DYN_TRAIT_TYPE@43..53 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast index 2bfb524530..de2016f188 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast @@ -60,7 +60,7 @@ SOURCE_FILE@0..91 COLON2@56..58 "::" NAME_REF@58..59 IDENT@58..59 "a" - TYPE_ARG_LIST@59..64 + GENERIC_ARG_LIST@59..64 COLON2@59..61 "::" L_ANGLE@61..62 "<" TYPE_ARG@62..63 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 629fea99d4..3a7fcfe248 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 @@ -17,7 +17,7 @@ SOURCE_FILE@0..42 PATH_SEGMENT@13..35 NAME_REF@13..21 IDENT@13..21 "Iterator" - TYPE_ARG_LIST@21..35 + GENERIC_ARG_LIST@21..35 L_ANGLE@21..22 "<" ASSOC_TYPE_ARG@22..34 NAME_REF@22..26 @@ -28,7 +28,7 @@ SOURCE_FILE@0..42 PATH_SEGMENT@27..34 NAME_REF@27..30 IDENT@27..30 "Foo" - TYPE_ARG_LIST@30..34 + GENERIC_ARG_LIST@30..34 L_ANGLE@30..31 "<" LIFETIME_ARG@31..33 LIFETIME@31..33 "\'a" 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 e7629ac031..5f48075221 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 @@ -95,7 +95,7 @@ SOURCE_FILE@0..121 PATH_SEGMENT@101..119 NAME_REF@101..110 IDENT@101..110 "PartialEq" - TYPE_ARG_LIST@110..119 + GENERIC_ARG_LIST@110..119 L_ANGLE@110..111 "<" TYPE_ARG@111..118 REFERENCE_TYPE@111..118 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 3f53d60c09..1244a50313 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 @@ -12,7 +12,7 @@ SOURCE_FILE@0..29 PATH_SEGMENT@9..27 NAME_REF@9..12 IDENT@9..12 "Box" - TYPE_ARG_LIST@12..27 + GENERIC_ARG_LIST@12..27 L_ANGLE@12..13 "<" TYPE_ARG@13..26 PATH_TYPE@13..26 diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast index b2961b0ff1..be8365e057 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast @@ -36,7 +36,7 @@ SOURCE_FILE@0..49 DOT@29..30 "." NAME_REF@30..33 IDENT@30..33 "bar" - TYPE_ARG_LIST@33..38 + GENERIC_ARG_LIST@33..38 COLON2@33..35 "::" L_ANGLE@35..36 "<" TYPE_ARG@36..37 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 157513565d..e0a82df751 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 @@ -18,7 +18,7 @@ SOURCE_FILE@0..59 PATH_SEGMENT@16..39 NAME_REF@16..24 IDENT@16..24 "Iterator" - TYPE_ARG_LIST@24..39 + GENERIC_ARG_LIST@24..39 L_ANGLE@24..25 "<" ASSOC_TYPE_ARG@25..38 NAME_REF@25..29 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 8f197a19d5..12194abdaf 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 @@ -22,7 +22,7 @@ SOURCE_FILE@0..29 PATH_SEGMENT@19..25 NAME_REF@19..22 IDENT@19..22 "Bar" - TYPE_ARG_LIST@22..25 + GENERIC_ARG_LIST@22..25 L_ANGLE@22..23 "<" TYPE_ARG@23..24 PATH_TYPE@23..24 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 cc220e5348..dac50410e4 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 @@ -20,7 +20,7 @@ SOURCE_FILE@0..83 PATH_SEGMENT@13..17 NAME_REF@13..14 IDENT@13..14 "T" - TYPE_ARG_LIST@14..17 + GENERIC_ARG_LIST@14..17 L_ANGLE@14..15 "<" TYPE_ARG@15..16 PATH_TYPE@15..16 @@ -52,7 +52,7 @@ SOURCE_FILE@0..83 PATH_SEGMENT@32..36 NAME_REF@32..33 IDENT@32..33 "T" - TYPE_ARG_LIST@33..36 + GENERIC_ARG_LIST@33..36 L_ANGLE@33..34 "<" TYPE_ARG@34..35 PATH_TYPE@34..35 @@ -115,7 +115,7 @@ SOURCE_FILE@0..83 PATH_SEGMENT@77..81 NAME_REF@77..78 IDENT@77..78 "T" - TYPE_ARG_LIST@78..81 + GENERIC_ARG_LIST@78..81 L_ANGLE@78..79 "<" TYPE_ARG@79..80 PATH_TYPE@79..80 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 10da87c71a..d59548f210 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 @@ -49,7 +49,7 @@ SOURCE_FILE@0..116 PATH_SEGMENT@65..81 NAME_REF@65..76 IDENT@65..76 "Deserialize" - TYPE_ARG_LIST@76..81 + GENERIC_ARG_LIST@76..81 L_ANGLE@76..77 "<" LIFETIME_ARG@77..80 LIFETIME@77..80 "\'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 1d75ed08f0..0e0c8c9dc3 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 @@ -249,7 +249,7 @@ SOURCE_FILE@0..3813 PATH_SEGMENT@653..663 NAME_REF@653..657 IDENT@653..657 "Cell" - TYPE_ARG_LIST@657..663 + GENERIC_ARG_LIST@657..663 L_ANGLE@657..658 "<" TYPE_ARG@658..662 PATH_TYPE@658..662 @@ -1588,7 +1588,7 @@ SOURCE_FILE@0..3813 PATH_SEGMENT@2888..2901 NAME_REF@2888..2893 IDENT@2888..2893 "union" - TYPE_ARG_LIST@2893..2901 + GENERIC_ARG_LIST@2893..2901 L_ANGLE@2893..2894 "<" LIFETIME_ARG@2894..2900 LIFETIME@2894..2900 "\'union" diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast index 139ce90469..bd152ffa32 100644 --- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast @@ -141,7 +141,7 @@ SOURCE_FILE@0..686 PATH_SEGMENT@589..600 NAME_REF@589..594 IDENT@589..594 "Event" - TYPE_ARG_LIST@594..600 + GENERIC_ARG_LIST@594..600 L_ANGLE@594..595 "<" TYPE_ARG@595..599 PATH_TYPE@595..599 diff --git a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast index 798e81ca65..48e1f07d1d 100644 --- a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast +++ b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast @@ -32,7 +32,7 @@ SOURCE_FILE@0..95 PATH_SEGMENT@28..48 NAME_REF@28..34 IDENT@28..34 "Future" - TYPE_ARG_LIST@34..48 + GENERIC_ARG_LIST@34..48 L_ANGLE@34..35 "<" ASSOC_TYPE_ARG@35..47 NAME_REF@35..41 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 2cc8497844..706ccdc391 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 @@ -172,7 +172,7 @@ SOURCE_FILE@0..519 PATH_SEGMENT@159..166 NAME_REF@159..162 IDENT@159..162 "Foo" - TYPE_ARG_LIST@162..166 + GENERIC_ARG_LIST@162..166 L_ANGLE@162..163 "<" LIFETIME_ARG@163..165 LIFETIME@163..165 "\'a" @@ -490,7 +490,7 @@ SOURCE_FILE@0..519 PATH_SEGMENT@505..513 NAME_REF@505..507 IDENT@505..507 "Rc" - TYPE_ARG_LIST@507..513 + GENERIC_ARG_LIST@507..513 L_ANGLE@507..508 "<" TYPE_ARG@508..512 PATH_TYPE@508..512 diff --git a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast index a300003986..fd4f4f2422 100644 --- a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast @@ -50,7 +50,7 @@ SOURCE_FILE@0..80 DOT@43..44 "." NAME_REF@44..47 IDENT@44..47 "sum" - TYPE_ARG_LIST@47..54 + GENERIC_ARG_LIST@47..54 COLON2@47..49 "::" L_ANGLE@49..50 "<" TYPE_ARG@50..53 diff --git a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast index e3997ac5b8..0d48c7e81b 100644 --- a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast @@ -16,7 +16,7 @@ SOURCE_FILE@0..88 PATH_SEGMENT@10..23 NAME_REF@10..13 IDENT@10..13 "Foo" - TYPE_ARG_LIST@13..23 + GENERIC_ARG_LIST@13..23 L_ANGLE@13..14 "<" TYPE_ARG@14..22 PATH_TYPE@14..22 diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 427406249c..762d9265e9 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -208,7 +208,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "LIFETIME_PARAM", "TYPE_PARAM", "CONST_PARAM", - "TYPE_ARG_LIST", + "GENERIC_ARG_LIST", "LIFETIME_ARG", "TYPE_ARG", "ASSOC_TYPE_ARG", diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 13ad67ca18..8acd02f754 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram @@ -3,11 +3,11 @@ Path = PathSegment = '::' | 'crate' | 'self' | 'super' -| (NameRef ('::'? TypeArgList)?) +| (NameRef ('::'? GenericArgList)?) | NameRef ParamList RetType? | '<' PathType ('as' PathType)? '>' -TypeArgList = +GenericArgList = '::'? '<' TypeArg* LifetimeArg* @@ -348,7 +348,7 @@ ArgList = '(' args:(Expr (',' Expr)* ','?)? ')' MethodCallExpr = - Attr* Expr '.' NameRef TypeArgList? ArgList + Attr* Expr '.' NameRef GenericArgList? ArgList FieldExpr = Attr* Expr '.' NameRef