mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 12:33:33 +00:00
Merge #5629
5629: Finalize Path grammar r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
5d9145ce10
41 changed files with 718 additions and 656 deletions
|
@ -79,19 +79,25 @@ impl<'a> SubstituteTypeParams<'a> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
|
// FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
|
||||||
// trait ref, and then go from the types in the substs back to the syntax)
|
// trait ref, and then go from the types in the substs back to the syntax).
|
||||||
fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> {
|
fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> {
|
||||||
let target_trait = impl_def.target_trait()?;
|
let target_trait = impl_def.target_trait()?;
|
||||||
let path_type = match target_trait {
|
let path_type = match target_trait {
|
||||||
ast::Type::PathType(path) => path,
|
ast::Type::PathType(path) => path,
|
||||||
_ => return None,
|
_ => return None,
|
||||||
};
|
};
|
||||||
let type_arg_list = path_type.path()?.segment()?.type_arg_list()?;
|
let generic_arg_list = path_type.path()?.segment()?.generic_arg_list()?;
|
||||||
|
|
||||||
let mut result = Vec::new();
|
let mut result = Vec::new();
|
||||||
for type_arg in type_arg_list.type_args() {
|
for generic_arg in generic_arg_list.generic_args() {
|
||||||
let type_arg: ast::TypeArg = type_arg;
|
match generic_arg {
|
||||||
result.push(type_arg.ty()?);
|
ast::GenericArg::TypeArg(type_arg) => result.push(type_arg.ty()?),
|
||||||
|
ast::GenericArg::AssocTypeArg(_)
|
||||||
|
| ast::GenericArg::LifetimeArg(_)
|
||||||
|
| ast::GenericArg::ConstArg(_) => (),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(result)
|
Some(result)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,7 +163,7 @@ impl<'a> QualifyPaths<'a> {
|
||||||
|
|
||||||
let type_args = p
|
let type_args = p
|
||||||
.segment()
|
.segment()
|
||||||
.and_then(|s| s.type_arg_list())
|
.and_then(|s| s.generic_arg_list())
|
||||||
.map(|arg_list| apply(self, arg_list));
|
.map(|arg_list| apply(self, arg_list));
|
||||||
if let Some(type_args) = type_args {
|
if let Some(type_args) = type_args {
|
||||||
let last_segment = path.segment().unwrap();
|
let last_segment = path.segment().unwrap();
|
||||||
|
|
|
@ -337,7 +337,7 @@ impl ExprCollector<'_> {
|
||||||
};
|
};
|
||||||
let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
|
let method_name = e.name_ref().map(|nr| nr.as_name()).unwrap_or_else(Name::missing);
|
||||||
let generic_args =
|
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(
|
self.alloc_expr(
|
||||||
Expr::MethodCall { receiver, method_name, args, generic_args },
|
Expr::MethodCall { receiver, method_name, args, generic_args },
|
||||||
syntax_ptr,
|
syntax_ptr,
|
||||||
|
|
|
@ -258,7 +258,7 @@ impl<'a> PathSegments<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GenericArgs {
|
impl GenericArgs {
|
||||||
pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::TypeArgList) -> Option<GenericArgs> {
|
pub(crate) fn from_ast(lower_ctx: &LowerCtx, node: ast::GenericArgList) -> Option<GenericArgs> {
|
||||||
lower::lower_generic_args(lower_ctx, node)
|
lower::lower_generic_args(lower_ctx, node)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
|
||||||
match hygiene.name_ref_to_name(name_ref) {
|
match hygiene.name_ref_to_name(name_ref) {
|
||||||
Either::Left(name) => {
|
Either::Left(name) => {
|
||||||
let args = segment
|
let args = segment
|
||||||
.type_arg_list()
|
.generic_arg_list()
|
||||||
.and_then(|it| lower_generic_args(&ctx, it))
|
.and_then(|it| lower_generic_args(&ctx, it))
|
||||||
.or_else(|| {
|
.or_else(|| {
|
||||||
lower_generic_args_from_fn_path(
|
lower_generic_args_from_fn_path(
|
||||||
|
@ -148,33 +148,37 @@ pub(super) fn lower_path(mut path: ast::Path, hygiene: &Hygiene) -> Option<Path>
|
||||||
|
|
||||||
pub(super) fn lower_generic_args(
|
pub(super) fn lower_generic_args(
|
||||||
lower_ctx: &LowerCtx,
|
lower_ctx: &LowerCtx,
|
||||||
node: ast::TypeArgList,
|
node: ast::GenericArgList,
|
||||||
) -> Option<GenericArgs> {
|
) -> Option<GenericArgs> {
|
||||||
let mut args = Vec::new();
|
let mut args = Vec::new();
|
||||||
for type_arg in node.type_args() {
|
|
||||||
let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
|
|
||||||
args.push(GenericArg::Type(type_ref));
|
|
||||||
}
|
|
||||||
// lifetimes ignored for now
|
|
||||||
let mut bindings = Vec::new();
|
let mut bindings = Vec::new();
|
||||||
for assoc_type_arg in node.assoc_type_args() {
|
for generic_arg in node.generic_args() {
|
||||||
let assoc_type_arg: ast::AssocTypeArg = assoc_type_arg;
|
match generic_arg {
|
||||||
if let Some(name_ref) = assoc_type_arg.name_ref() {
|
ast::GenericArg::TypeArg(type_arg) => {
|
||||||
let name = name_ref.as_name();
|
let type_ref = TypeRef::from_ast_opt(lower_ctx, type_arg.ty());
|
||||||
let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
|
args.push(GenericArg::Type(type_ref));
|
||||||
let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
|
}
|
||||||
l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
|
ast::GenericArg::AssocTypeArg(assoc_type_arg) => {
|
||||||
} else {
|
if let Some(name_ref) = assoc_type_arg.name_ref() {
|
||||||
Vec::new()
|
let name = name_ref.as_name();
|
||||||
};
|
let type_ref = assoc_type_arg.ty().map(|it| TypeRef::from_ast(lower_ctx, it));
|
||||||
bindings.push(AssociatedTypeBinding { name, type_ref, bounds });
|
let bounds = if let Some(l) = assoc_type_arg.type_bound_list() {
|
||||||
|
l.bounds().map(|it| TypeBound::from_ast(lower_ctx, it)).collect()
|
||||||
|
} else {
|
||||||
|
Vec::new()
|
||||||
|
};
|
||||||
|
bindings.push(AssociatedTypeBinding { name, type_ref, bounds });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Lifetimes and constants are ignored for now.
|
||||||
|
ast::GenericArg::LifetimeArg(_) | ast::GenericArg::ConstArg(_) => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if args.is_empty() && bindings.is_empty() {
|
if args.is_empty() && bindings.is_empty() {
|
||||||
None
|
return None;
|
||||||
} else {
|
|
||||||
Some(GenericArgs { args, has_self_type: false, bindings })
|
|
||||||
}
|
}
|
||||||
|
Some(GenericArgs { args, has_self_type: false, bindings })
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y)
|
/// Collect `GenericArgs` from the parts of a fn-like path, i.e. `Fn(X, Y)
|
||||||
|
|
|
@ -377,7 +377,7 @@ impl<'a> CompletionContext<'a> {
|
||||||
path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some();
|
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.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)]
|
#[allow(deprecated)]
|
||||||
if let Some(path) = hir::Path::from_ast(path.clone()) {
|
if let Some(path) = hir::Path::from_ast(path.clone()) {
|
||||||
|
|
|
@ -45,7 +45,7 @@ fn try_extend_selection(
|
||||||
VARIANT_LIST,
|
VARIANT_LIST,
|
||||||
USE_TREE_LIST,
|
USE_TREE_LIST,
|
||||||
GENERIC_PARAM_LIST,
|
GENERIC_PARAM_LIST,
|
||||||
TYPE_ARG_LIST,
|
GENERIC_ARG_LIST,
|
||||||
TYPE_BOUND_LIST,
|
TYPE_BOUND_LIST,
|
||||||
PARAM_LIST,
|
PARAM_LIST,
|
||||||
ARG_LIST,
|
ARG_LIST,
|
||||||
|
|
|
@ -22,7 +22,7 @@ pub(super) fn opt_type_arg_list(p: &mut Parser, colon_colon_required: bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.expect(T![>]);
|
p.expect(T![>]);
|
||||||
m.complete(p, TYPE_ARG_LIST);
|
m.complete(p, GENERIC_ARG_LIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test type_arg
|
// test type_arg
|
||||||
|
@ -52,7 +52,7 @@ fn type_arg(p: &mut Parser) {
|
||||||
m.complete(p, CONST_ARG);
|
m.complete(p, CONST_ARG);
|
||||||
}
|
}
|
||||||
k if k.is_literal() => {
|
k if k.is_literal() => {
|
||||||
p.bump(k);
|
expressions::literal(p);
|
||||||
m.complete(p, CONST_ARG);
|
m.complete(p, CONST_ARG);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|
|
@ -235,7 +235,7 @@ pub enum SyntaxKind {
|
||||||
LIFETIME_PARAM,
|
LIFETIME_PARAM,
|
||||||
TYPE_PARAM,
|
TYPE_PARAM,
|
||||||
CONST_PARAM,
|
CONST_PARAM,
|
||||||
TYPE_ARG_LIST,
|
GENERIC_ARG_LIST,
|
||||||
LIFETIME_ARG,
|
LIFETIME_ARG,
|
||||||
TYPE_ARG,
|
TYPE_ARG,
|
||||||
ASSOC_TYPE_ARG,
|
ASSOC_TYPE_ARG,
|
||||||
|
|
|
@ -348,8 +348,8 @@ impl<'db, 'sema> Matcher<'db, 'sema> {
|
||||||
// separately via comparing what the path resolves to below.
|
// separately via comparing what the path resolves to below.
|
||||||
self.attempt_match_opt(
|
self.attempt_match_opt(
|
||||||
phase,
|
phase,
|
||||||
pattern_segment.type_arg_list(),
|
pattern_segment.generic_arg_list(),
|
||||||
code_segment.type_arg_list(),
|
code_segment.generic_arg_list(),
|
||||||
)?;
|
)?;
|
||||||
self.attempt_match_opt(
|
self.attempt_match_opt(
|
||||||
phase,
|
phase,
|
||||||
|
|
|
@ -217,7 +217,7 @@ fn pick_node_for_resolution(node: SyntaxNode) -> SyntaxNode {
|
||||||
fn path_contains_type_arguments(path: Option<ast::Path>) -> bool {
|
fn path_contains_type_arguments(path: Option<ast::Path>) -> bool {
|
||||||
if let Some(path) = path {
|
if let Some(path) = path {
|
||||||
if let Some(segment) = path.segment() {
|
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);
|
mark::hit!(type_arguments_within_path);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,17 +237,17 @@ impl ast::Path {
|
||||||
|
|
||||||
impl ast::PathSegment {
|
impl ast::PathSegment {
|
||||||
#[must_use]
|
#[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)
|
self._with_type_args(type_args, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[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)
|
self._with_type_args(type_args, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _with_type_args(&self, type_args: ast::TypeArgList, turbo: bool) -> ast::PathSegment {
|
fn _with_type_args(&self, type_args: ast::GenericArgList, turbo: bool) -> ast::PathSegment {
|
||||||
if let Some(old) = self.type_arg_list() {
|
if let Some(old) = self.generic_arg_list() {
|
||||||
return self.replace_children(
|
return self.replace_children(
|
||||||
single_node(old.syntax().clone()),
|
single_node(old.syntax().clone()),
|
||||||
iter::once(type_args.syntax().clone().into()),
|
iter::once(type_args.syntax().clone().into()),
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -25,7 +25,7 @@ SOURCE_FILE@0..389
|
||||||
PATH_SEGMENT@29..37
|
PATH_SEGMENT@29..37
|
||||||
NAME_REF@29..33
|
NAME_REF@29..33
|
||||||
IDENT@29..33 "Sink"
|
IDENT@29..33 "Sink"
|
||||||
TYPE_ARG_LIST@33..37
|
GENERIC_ARG_LIST@33..37
|
||||||
L_ANGLE@33..34
|
L_ANGLE@33..34
|
||||||
LIFETIME_ARG@34..36
|
LIFETIME_ARG@34..36
|
||||||
LIFETIME@34..36 "'a"
|
LIFETIME@34..36 "'a"
|
||||||
|
@ -79,7 +79,7 @@ SOURCE_FILE@0..389
|
||||||
PATH_SEGMENT@82..92
|
PATH_SEGMENT@82..92
|
||||||
NAME_REF@82..85
|
NAME_REF@82..85
|
||||||
IDENT@82..85 "Vec"
|
IDENT@82..85 "Vec"
|
||||||
TYPE_ARG_LIST@85..92
|
GENERIC_ARG_LIST@85..92
|
||||||
L_ANGLE@85..86
|
L_ANGLE@85..86
|
||||||
TYPE_ARG@86..91
|
TYPE_ARG@86..91
|
||||||
PATH_TYPE@86..91
|
PATH_TYPE@86..91
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..86
|
||||||
PATH_SEGMENT@22..68
|
PATH_SEGMENT@22..68
|
||||||
NAME_REF@22..29
|
NAME_REF@22..29
|
||||||
IDENT@22..29 "RefCell"
|
IDENT@22..29 "RefCell"
|
||||||
TYPE_ARG_LIST@29..68
|
GENERIC_ARG_LIST@29..68
|
||||||
L_ANGLE@29..30 "<"
|
L_ANGLE@29..30 "<"
|
||||||
TYPE_ARG@30..68
|
TYPE_ARG@30..68
|
||||||
PATH_TYPE@30..68
|
PATH_TYPE@30..68
|
||||||
|
@ -24,7 +24,7 @@ SOURCE_FILE@0..86
|
||||||
PATH_SEGMENT@30..68
|
PATH_SEGMENT@30..68
|
||||||
NAME_REF@30..37
|
NAME_REF@30..37
|
||||||
IDENT@30..37 "HashMap"
|
IDENT@30..37 "HashMap"
|
||||||
TYPE_ARG_LIST@37..68
|
GENERIC_ARG_LIST@37..68
|
||||||
L_ANGLE@37..38 "<"
|
L_ANGLE@37..38 "<"
|
||||||
WHITESPACE@38..47 "\n "
|
WHITESPACE@38..47 "\n "
|
||||||
TYPE_ARG@47..53
|
TYPE_ARG@47..53
|
||||||
|
@ -41,7 +41,7 @@ SOURCE_FILE@0..86
|
||||||
PATH_SEGMENT@63..68
|
PATH_SEGMENT@63..68
|
||||||
NAME_REF@63..66
|
NAME_REF@63..66
|
||||||
IDENT@63..66 "Box"
|
IDENT@63..66 "Box"
|
||||||
TYPE_ARG_LIST@66..68
|
GENERIC_ARG_LIST@66..68
|
||||||
L_ANGLE@66..67 "<"
|
L_ANGLE@66..67 "<"
|
||||||
TYPE_ARG@67..68
|
TYPE_ARG@67..68
|
||||||
ERROR@67..68
|
ERROR@67..68
|
||||||
|
|
|
@ -50,7 +50,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@37..46
|
PATH_SEGMENT@37..46
|
||||||
NAME_REF@37..42
|
NAME_REF@37..42
|
||||||
IDENT@37..42 "Trait"
|
IDENT@37..42 "Trait"
|
||||||
TYPE_ARG_LIST@42..46
|
GENERIC_ARG_LIST@42..46
|
||||||
L_ANGLE@42..43 "<"
|
L_ANGLE@42..43 "<"
|
||||||
LIFETIME_ARG@43..45
|
LIFETIME_ARG@43..45
|
||||||
LIFETIME@43..45 "\'a"
|
LIFETIME@43..45 "\'a"
|
||||||
|
@ -92,7 +92,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@78..88
|
PATH_SEGMENT@78..88
|
||||||
NAME_REF@78..81
|
NAME_REF@78..81
|
||||||
IDENT@78..81 "Box"
|
IDENT@78..81 "Box"
|
||||||
TYPE_ARG_LIST@81..88
|
GENERIC_ARG_LIST@81..88
|
||||||
L_ANGLE@81..82 "<"
|
L_ANGLE@81..82 "<"
|
||||||
TYPE_ARG@82..88
|
TYPE_ARG@82..88
|
||||||
PAREN_TYPE@82..88
|
PAREN_TYPE@82..88
|
||||||
|
@ -133,7 +133,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@111..120
|
PATH_SEGMENT@111..120
|
||||||
NAME_REF@111..116
|
NAME_REF@111..116
|
||||||
IDENT@111..116 "Trait"
|
IDENT@111..116 "Trait"
|
||||||
TYPE_ARG_LIST@116..120
|
GENERIC_ARG_LIST@116..120
|
||||||
L_ANGLE@116..117 "<"
|
L_ANGLE@116..117 "<"
|
||||||
LIFETIME_ARG@117..119
|
LIFETIME_ARG@117..119
|
||||||
LIFETIME@117..119 "\'a"
|
LIFETIME@117..119 "\'a"
|
||||||
|
@ -156,7 +156,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@135..141
|
PATH_SEGMENT@135..141
|
||||||
NAME_REF@135..138
|
NAME_REF@135..138
|
||||||
IDENT@135..138 "Box"
|
IDENT@135..138 "Box"
|
||||||
TYPE_ARG_LIST@138..141
|
GENERIC_ARG_LIST@138..141
|
||||||
L_ANGLE@138..139 "<"
|
L_ANGLE@138..139 "<"
|
||||||
TYPE_ARG@139..141
|
TYPE_ARG@139..141
|
||||||
PAREN_TYPE@139..141
|
PAREN_TYPE@139..141
|
||||||
|
@ -235,7 +235,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@192..215
|
PATH_SEGMENT@192..215
|
||||||
NAME_REF@192..195
|
NAME_REF@192..195
|
||||||
IDENT@192..195 "Box"
|
IDENT@192..195 "Box"
|
||||||
TYPE_ARG_LIST@195..215
|
GENERIC_ARG_LIST@195..215
|
||||||
L_ANGLE@195..196 "<"
|
L_ANGLE@195..196 "<"
|
||||||
TYPE_ARG@196..215
|
TYPE_ARG@196..215
|
||||||
PAREN_TYPE@196..215
|
PAREN_TYPE@196..215
|
||||||
|
@ -253,7 +253,7 @@ SOURCE_FILE@0..240
|
||||||
PATH_SEGMENT@205..214
|
PATH_SEGMENT@205..214
|
||||||
NAME_REF@205..210
|
NAME_REF@205..210
|
||||||
IDENT@205..210 "Trait"
|
IDENT@205..210 "Trait"
|
||||||
TYPE_ARG_LIST@210..214
|
GENERIC_ARG_LIST@210..214
|
||||||
L_ANGLE@210..211 "<"
|
L_ANGLE@210..211 "<"
|
||||||
LIFETIME_ARG@211..213
|
LIFETIME_ARG@211..213
|
||||||
LIFETIME@211..213 "\'a"
|
LIFETIME@211..213 "\'a"
|
||||||
|
|
|
@ -31,7 +31,7 @@ SOURCE_FILE@0..38
|
||||||
PATH_SEGMENT@23..34
|
PATH_SEGMENT@23..34
|
||||||
NAME_REF@23..31
|
NAME_REF@23..31
|
||||||
IDENT@23..31 "OnceCell"
|
IDENT@23..31 "OnceCell"
|
||||||
TYPE_ARG_LIST@31..34
|
GENERIC_ARG_LIST@31..34
|
||||||
L_ANGLE@31..32 "<"
|
L_ANGLE@31..32 "<"
|
||||||
TYPE_ARG@32..33
|
TYPE_ARG@32..33
|
||||||
PATH_TYPE@32..33
|
PATH_TYPE@32..33
|
||||||
|
|
|
@ -62,7 +62,7 @@ SOURCE_FILE@0..83
|
||||||
DOT@66..67 "."
|
DOT@66..67 "."
|
||||||
NAME_REF@67..70
|
NAME_REF@67..70
|
||||||
IDENT@67..70 "max"
|
IDENT@67..70 "max"
|
||||||
TYPE_ARG_LIST@70..77
|
GENERIC_ARG_LIST@70..77
|
||||||
COLON2@70..72 "::"
|
COLON2@70..72 "::"
|
||||||
L_ANGLE@72..73 "<"
|
L_ANGLE@72..73 "<"
|
||||||
TYPE_ARG@73..76
|
TYPE_ARG@73..76
|
||||||
|
|
|
@ -3,7 +3,7 @@ PATH_TYPE@0..16
|
||||||
PATH_SEGMENT@0..16
|
PATH_SEGMENT@0..16
|
||||||
NAME_REF@0..6
|
NAME_REF@0..6
|
||||||
IDENT@0..6 "Result"
|
IDENT@0..6 "Result"
|
||||||
TYPE_ARG_LIST@6..16
|
GENERIC_ARG_LIST@6..16
|
||||||
L_ANGLE@6..7 "<"
|
L_ANGLE@6..7 "<"
|
||||||
TYPE_ARG@7..10
|
TYPE_ARG@7..10
|
||||||
PATH_TYPE@7..10
|
PATH_TYPE@7..10
|
||||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..39
|
||||||
PATH_SEGMENT@9..37
|
PATH_SEGMENT@9..37
|
||||||
NAME_REF@9..12
|
NAME_REF@9..12
|
||||||
IDENT@9..12 "Box"
|
IDENT@9..12 "Box"
|
||||||
TYPE_ARG_LIST@12..37
|
GENERIC_ARG_LIST@12..37
|
||||||
L_ANGLE@12..13 "<"
|
L_ANGLE@12..13 "<"
|
||||||
TYPE_ARG@13..36
|
TYPE_ARG@13..36
|
||||||
PATH_TYPE@13..36
|
PATH_TYPE@13..36
|
||||||
|
|
|
@ -53,7 +53,7 @@ SOURCE_FILE@0..69
|
||||||
PATH_SEGMENT@53..62
|
PATH_SEGMENT@53..62
|
||||||
NAME_REF@53..56
|
NAME_REF@53..56
|
||||||
IDENT@53..56 "Box"
|
IDENT@53..56 "Box"
|
||||||
TYPE_ARG_LIST@56..62
|
GENERIC_ARG_LIST@56..62
|
||||||
L_ANGLE@56..57 "<"
|
L_ANGLE@56..57 "<"
|
||||||
TYPE_ARG@57..61
|
TYPE_ARG@57..61
|
||||||
PATH_TYPE@57..61
|
PATH_TYPE@57..61
|
||||||
|
|
|
@ -17,7 +17,7 @@ SOURCE_FILE@0..43
|
||||||
PATH_SEGMENT@14..36
|
PATH_SEGMENT@14..36
|
||||||
NAME_REF@14..22
|
NAME_REF@14..22
|
||||||
IDENT@14..22 "Iterator"
|
IDENT@14..22 "Iterator"
|
||||||
TYPE_ARG_LIST@22..36
|
GENERIC_ARG_LIST@22..36
|
||||||
L_ANGLE@22..23 "<"
|
L_ANGLE@22..23 "<"
|
||||||
ASSOC_TYPE_ARG@23..35
|
ASSOC_TYPE_ARG@23..35
|
||||||
NAME_REF@23..27
|
NAME_REF@23..27
|
||||||
|
@ -28,7 +28,7 @@ SOURCE_FILE@0..43
|
||||||
PATH_SEGMENT@28..35
|
PATH_SEGMENT@28..35
|
||||||
NAME_REF@28..31
|
NAME_REF@28..31
|
||||||
IDENT@28..31 "Foo"
|
IDENT@28..31 "Foo"
|
||||||
TYPE_ARG_LIST@31..35
|
GENERIC_ARG_LIST@31..35
|
||||||
L_ANGLE@31..32 "<"
|
L_ANGLE@31..32 "<"
|
||||||
LIFETIME_ARG@32..34
|
LIFETIME_ARG@32..34
|
||||||
LIFETIME@32..34 "\'a"
|
LIFETIME@32..34 "\'a"
|
||||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..46
|
||||||
PATH_SEGMENT@9..44
|
PATH_SEGMENT@9..44
|
||||||
NAME_REF@9..10
|
NAME_REF@9..10
|
||||||
IDENT@9..10 "B"
|
IDENT@9..10 "B"
|
||||||
TYPE_ARG_LIST@10..44
|
GENERIC_ARG_LIST@10..44
|
||||||
L_ANGLE@10..11 "<"
|
L_ANGLE@10..11 "<"
|
||||||
LIFETIME_ARG@11..18
|
LIFETIME_ARG@11..18
|
||||||
LIFETIME@11..18 "\'static"
|
LIFETIME@11..18 "\'static"
|
||||||
|
@ -27,7 +27,8 @@ SOURCE_FILE@0..46
|
||||||
COMMA@23..24 ","
|
COMMA@23..24 ","
|
||||||
WHITESPACE@24..25 " "
|
WHITESPACE@24..25 " "
|
||||||
CONST_ARG@25..26
|
CONST_ARG@25..26
|
||||||
INT_NUMBER@25..26 "1"
|
LITERAL@25..26
|
||||||
|
INT_NUMBER@25..26 "1"
|
||||||
COMMA@26..27 ","
|
COMMA@26..27 ","
|
||||||
WHITESPACE@27..28 " "
|
WHITESPACE@27..28 " "
|
||||||
CONST_ARG@28..33
|
CONST_ARG@28..33
|
||||||
|
|
|
@ -30,7 +30,7 @@ SOURCE_FILE@0..35
|
||||||
PATH_SEGMENT@21..28
|
PATH_SEGMENT@21..28
|
||||||
NAME_REF@21..24
|
NAME_REF@21..24
|
||||||
IDENT@21..24 "Foo"
|
IDENT@21..24 "Foo"
|
||||||
TYPE_ARG_LIST@24..28
|
GENERIC_ARG_LIST@24..28
|
||||||
L_ANGLE@24..25 "<"
|
L_ANGLE@24..25 "<"
|
||||||
LIFETIME_ARG@25..27
|
LIFETIME_ARG@25..27
|
||||||
LIFETIME@25..27 "\'a"
|
LIFETIME@25..27 "\'a"
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..58
|
||||||
PATH_SEGMENT@12..23
|
PATH_SEGMENT@12..23
|
||||||
NAME_REF@12..15
|
NAME_REF@12..15
|
||||||
IDENT@12..15 "Box"
|
IDENT@12..15 "Box"
|
||||||
TYPE_ARG_LIST@15..23
|
GENERIC_ARG_LIST@15..23
|
||||||
L_ANGLE@15..16 "<"
|
L_ANGLE@15..16 "<"
|
||||||
TYPE_ARG@16..22
|
TYPE_ARG@16..22
|
||||||
DYN_TRAIT_TYPE@16..22
|
DYN_TRAIT_TYPE@16..22
|
||||||
|
@ -55,7 +55,7 @@ SOURCE_FILE@0..58
|
||||||
PATH_SEGMENT@39..54
|
PATH_SEGMENT@39..54
|
||||||
NAME_REF@39..42
|
NAME_REF@39..42
|
||||||
IDENT@39..42 "Box"
|
IDENT@39..42 "Box"
|
||||||
TYPE_ARG_LIST@42..54
|
GENERIC_ARG_LIST@42..54
|
||||||
L_ANGLE@42..43 "<"
|
L_ANGLE@42..43 "<"
|
||||||
TYPE_ARG@43..53
|
TYPE_ARG@43..53
|
||||||
DYN_TRAIT_TYPE@43..53
|
DYN_TRAIT_TYPE@43..53
|
||||||
|
|
|
@ -60,7 +60,7 @@ SOURCE_FILE@0..91
|
||||||
COLON2@56..58 "::"
|
COLON2@56..58 "::"
|
||||||
NAME_REF@58..59
|
NAME_REF@58..59
|
||||||
IDENT@58..59 "a"
|
IDENT@58..59 "a"
|
||||||
TYPE_ARG_LIST@59..64
|
GENERIC_ARG_LIST@59..64
|
||||||
COLON2@59..61 "::"
|
COLON2@59..61 "::"
|
||||||
L_ANGLE@61..62 "<"
|
L_ANGLE@61..62 "<"
|
||||||
TYPE_ARG@62..63
|
TYPE_ARG@62..63
|
||||||
|
|
|
@ -17,7 +17,7 @@ SOURCE_FILE@0..42
|
||||||
PATH_SEGMENT@13..35
|
PATH_SEGMENT@13..35
|
||||||
NAME_REF@13..21
|
NAME_REF@13..21
|
||||||
IDENT@13..21 "Iterator"
|
IDENT@13..21 "Iterator"
|
||||||
TYPE_ARG_LIST@21..35
|
GENERIC_ARG_LIST@21..35
|
||||||
L_ANGLE@21..22 "<"
|
L_ANGLE@21..22 "<"
|
||||||
ASSOC_TYPE_ARG@22..34
|
ASSOC_TYPE_ARG@22..34
|
||||||
NAME_REF@22..26
|
NAME_REF@22..26
|
||||||
|
@ -28,7 +28,7 @@ SOURCE_FILE@0..42
|
||||||
PATH_SEGMENT@27..34
|
PATH_SEGMENT@27..34
|
||||||
NAME_REF@27..30
|
NAME_REF@27..30
|
||||||
IDENT@27..30 "Foo"
|
IDENT@27..30 "Foo"
|
||||||
TYPE_ARG_LIST@30..34
|
GENERIC_ARG_LIST@30..34
|
||||||
L_ANGLE@30..31 "<"
|
L_ANGLE@30..31 "<"
|
||||||
LIFETIME_ARG@31..33
|
LIFETIME_ARG@31..33
|
||||||
LIFETIME@31..33 "\'a"
|
LIFETIME@31..33 "\'a"
|
||||||
|
|
|
@ -95,7 +95,7 @@ SOURCE_FILE@0..121
|
||||||
PATH_SEGMENT@101..119
|
PATH_SEGMENT@101..119
|
||||||
NAME_REF@101..110
|
NAME_REF@101..110
|
||||||
IDENT@101..110 "PartialEq"
|
IDENT@101..110 "PartialEq"
|
||||||
TYPE_ARG_LIST@110..119
|
GENERIC_ARG_LIST@110..119
|
||||||
L_ANGLE@110..111 "<"
|
L_ANGLE@110..111 "<"
|
||||||
TYPE_ARG@111..118
|
TYPE_ARG@111..118
|
||||||
REFERENCE_TYPE@111..118
|
REFERENCE_TYPE@111..118
|
||||||
|
|
|
@ -12,7 +12,7 @@ SOURCE_FILE@0..29
|
||||||
PATH_SEGMENT@9..27
|
PATH_SEGMENT@9..27
|
||||||
NAME_REF@9..12
|
NAME_REF@9..12
|
||||||
IDENT@9..12 "Box"
|
IDENT@9..12 "Box"
|
||||||
TYPE_ARG_LIST@12..27
|
GENERIC_ARG_LIST@12..27
|
||||||
L_ANGLE@12..13 "<"
|
L_ANGLE@12..13 "<"
|
||||||
TYPE_ARG@13..26
|
TYPE_ARG@13..26
|
||||||
PATH_TYPE@13..26
|
PATH_TYPE@13..26
|
||||||
|
|
|
@ -36,7 +36,7 @@ SOURCE_FILE@0..49
|
||||||
DOT@29..30 "."
|
DOT@29..30 "."
|
||||||
NAME_REF@30..33
|
NAME_REF@30..33
|
||||||
IDENT@30..33 "bar"
|
IDENT@30..33 "bar"
|
||||||
TYPE_ARG_LIST@33..38
|
GENERIC_ARG_LIST@33..38
|
||||||
COLON2@33..35 "::"
|
COLON2@33..35 "::"
|
||||||
L_ANGLE@35..36 "<"
|
L_ANGLE@35..36 "<"
|
||||||
TYPE_ARG@36..37
|
TYPE_ARG@36..37
|
||||||
|
|
|
@ -18,7 +18,7 @@ SOURCE_FILE@0..59
|
||||||
PATH_SEGMENT@16..39
|
PATH_SEGMENT@16..39
|
||||||
NAME_REF@16..24
|
NAME_REF@16..24
|
||||||
IDENT@16..24 "Iterator"
|
IDENT@16..24 "Iterator"
|
||||||
TYPE_ARG_LIST@24..39
|
GENERIC_ARG_LIST@24..39
|
||||||
L_ANGLE@24..25 "<"
|
L_ANGLE@24..25 "<"
|
||||||
ASSOC_TYPE_ARG@25..38
|
ASSOC_TYPE_ARG@25..38
|
||||||
NAME_REF@25..29
|
NAME_REF@25..29
|
||||||
|
|
|
@ -22,7 +22,7 @@ SOURCE_FILE@0..29
|
||||||
PATH_SEGMENT@19..25
|
PATH_SEGMENT@19..25
|
||||||
NAME_REF@19..22
|
NAME_REF@19..22
|
||||||
IDENT@19..22 "Bar"
|
IDENT@19..22 "Bar"
|
||||||
TYPE_ARG_LIST@22..25
|
GENERIC_ARG_LIST@22..25
|
||||||
L_ANGLE@22..23 "<"
|
L_ANGLE@22..23 "<"
|
||||||
TYPE_ARG@23..24
|
TYPE_ARG@23..24
|
||||||
PATH_TYPE@23..24
|
PATH_TYPE@23..24
|
||||||
|
|
|
@ -20,7 +20,7 @@ SOURCE_FILE@0..83
|
||||||
PATH_SEGMENT@13..17
|
PATH_SEGMENT@13..17
|
||||||
NAME_REF@13..14
|
NAME_REF@13..14
|
||||||
IDENT@13..14 "T"
|
IDENT@13..14 "T"
|
||||||
TYPE_ARG_LIST@14..17
|
GENERIC_ARG_LIST@14..17
|
||||||
L_ANGLE@14..15 "<"
|
L_ANGLE@14..15 "<"
|
||||||
TYPE_ARG@15..16
|
TYPE_ARG@15..16
|
||||||
PATH_TYPE@15..16
|
PATH_TYPE@15..16
|
||||||
|
@ -52,7 +52,7 @@ SOURCE_FILE@0..83
|
||||||
PATH_SEGMENT@32..36
|
PATH_SEGMENT@32..36
|
||||||
NAME_REF@32..33
|
NAME_REF@32..33
|
||||||
IDENT@32..33 "T"
|
IDENT@32..33 "T"
|
||||||
TYPE_ARG_LIST@33..36
|
GENERIC_ARG_LIST@33..36
|
||||||
L_ANGLE@33..34 "<"
|
L_ANGLE@33..34 "<"
|
||||||
TYPE_ARG@34..35
|
TYPE_ARG@34..35
|
||||||
PATH_TYPE@34..35
|
PATH_TYPE@34..35
|
||||||
|
@ -115,7 +115,7 @@ SOURCE_FILE@0..83
|
||||||
PATH_SEGMENT@77..81
|
PATH_SEGMENT@77..81
|
||||||
NAME_REF@77..78
|
NAME_REF@77..78
|
||||||
IDENT@77..78 "T"
|
IDENT@77..78 "T"
|
||||||
TYPE_ARG_LIST@78..81
|
GENERIC_ARG_LIST@78..81
|
||||||
L_ANGLE@78..79 "<"
|
L_ANGLE@78..79 "<"
|
||||||
TYPE_ARG@79..80
|
TYPE_ARG@79..80
|
||||||
PATH_TYPE@79..80
|
PATH_TYPE@79..80
|
||||||
|
|
|
@ -49,7 +49,7 @@ SOURCE_FILE@0..116
|
||||||
PATH_SEGMENT@65..81
|
PATH_SEGMENT@65..81
|
||||||
NAME_REF@65..76
|
NAME_REF@65..76
|
||||||
IDENT@65..76 "Deserialize"
|
IDENT@65..76 "Deserialize"
|
||||||
TYPE_ARG_LIST@76..81
|
GENERIC_ARG_LIST@76..81
|
||||||
L_ANGLE@76..77 "<"
|
L_ANGLE@76..77 "<"
|
||||||
LIFETIME_ARG@77..80
|
LIFETIME_ARG@77..80
|
||||||
LIFETIME@77..80 "\'de"
|
LIFETIME@77..80 "\'de"
|
||||||
|
|
|
@ -249,7 +249,7 @@ SOURCE_FILE@0..3813
|
||||||
PATH_SEGMENT@653..663
|
PATH_SEGMENT@653..663
|
||||||
NAME_REF@653..657
|
NAME_REF@653..657
|
||||||
IDENT@653..657 "Cell"
|
IDENT@653..657 "Cell"
|
||||||
TYPE_ARG_LIST@657..663
|
GENERIC_ARG_LIST@657..663
|
||||||
L_ANGLE@657..658 "<"
|
L_ANGLE@657..658 "<"
|
||||||
TYPE_ARG@658..662
|
TYPE_ARG@658..662
|
||||||
PATH_TYPE@658..662
|
PATH_TYPE@658..662
|
||||||
|
@ -1588,7 +1588,7 @@ SOURCE_FILE@0..3813
|
||||||
PATH_SEGMENT@2888..2901
|
PATH_SEGMENT@2888..2901
|
||||||
NAME_REF@2888..2893
|
NAME_REF@2888..2893
|
||||||
IDENT@2888..2893 "union"
|
IDENT@2888..2893 "union"
|
||||||
TYPE_ARG_LIST@2893..2901
|
GENERIC_ARG_LIST@2893..2901
|
||||||
L_ANGLE@2893..2894 "<"
|
L_ANGLE@2893..2894 "<"
|
||||||
LIFETIME_ARG@2894..2900
|
LIFETIME_ARG@2894..2900
|
||||||
LIFETIME@2894..2900 "\'union"
|
LIFETIME@2894..2900 "\'union"
|
||||||
|
|
|
@ -141,7 +141,7 @@ SOURCE_FILE@0..686
|
||||||
PATH_SEGMENT@589..600
|
PATH_SEGMENT@589..600
|
||||||
NAME_REF@589..594
|
NAME_REF@589..594
|
||||||
IDENT@589..594 "Event"
|
IDENT@589..594 "Event"
|
||||||
TYPE_ARG_LIST@594..600
|
GENERIC_ARG_LIST@594..600
|
||||||
L_ANGLE@594..595 "<"
|
L_ANGLE@594..595 "<"
|
||||||
TYPE_ARG@595..599
|
TYPE_ARG@595..599
|
||||||
PATH_TYPE@595..599
|
PATH_TYPE@595..599
|
||||||
|
|
|
@ -32,7 +32,7 @@ SOURCE_FILE@0..95
|
||||||
PATH_SEGMENT@28..48
|
PATH_SEGMENT@28..48
|
||||||
NAME_REF@28..34
|
NAME_REF@28..34
|
||||||
IDENT@28..34 "Future"
|
IDENT@28..34 "Future"
|
||||||
TYPE_ARG_LIST@34..48
|
GENERIC_ARG_LIST@34..48
|
||||||
L_ANGLE@34..35 "<"
|
L_ANGLE@34..35 "<"
|
||||||
ASSOC_TYPE_ARG@35..47
|
ASSOC_TYPE_ARG@35..47
|
||||||
NAME_REF@35..41
|
NAME_REF@35..41
|
||||||
|
|
|
@ -172,7 +172,7 @@ SOURCE_FILE@0..519
|
||||||
PATH_SEGMENT@159..166
|
PATH_SEGMENT@159..166
|
||||||
NAME_REF@159..162
|
NAME_REF@159..162
|
||||||
IDENT@159..162 "Foo"
|
IDENT@159..162 "Foo"
|
||||||
TYPE_ARG_LIST@162..166
|
GENERIC_ARG_LIST@162..166
|
||||||
L_ANGLE@162..163 "<"
|
L_ANGLE@162..163 "<"
|
||||||
LIFETIME_ARG@163..165
|
LIFETIME_ARG@163..165
|
||||||
LIFETIME@163..165 "\'a"
|
LIFETIME@163..165 "\'a"
|
||||||
|
@ -490,7 +490,7 @@ SOURCE_FILE@0..519
|
||||||
PATH_SEGMENT@505..513
|
PATH_SEGMENT@505..513
|
||||||
NAME_REF@505..507
|
NAME_REF@505..507
|
||||||
IDENT@505..507 "Rc"
|
IDENT@505..507 "Rc"
|
||||||
TYPE_ARG_LIST@507..513
|
GENERIC_ARG_LIST@507..513
|
||||||
L_ANGLE@507..508 "<"
|
L_ANGLE@507..508 "<"
|
||||||
TYPE_ARG@508..512
|
TYPE_ARG@508..512
|
||||||
PATH_TYPE@508..512
|
PATH_TYPE@508..512
|
||||||
|
|
|
@ -50,7 +50,7 @@ SOURCE_FILE@0..80
|
||||||
DOT@43..44 "."
|
DOT@43..44 "."
|
||||||
NAME_REF@44..47
|
NAME_REF@44..47
|
||||||
IDENT@44..47 "sum"
|
IDENT@44..47 "sum"
|
||||||
TYPE_ARG_LIST@47..54
|
GENERIC_ARG_LIST@47..54
|
||||||
COLON2@47..49 "::"
|
COLON2@47..49 "::"
|
||||||
L_ANGLE@49..50 "<"
|
L_ANGLE@49..50 "<"
|
||||||
TYPE_ARG@50..53
|
TYPE_ARG@50..53
|
||||||
|
|
|
@ -16,7 +16,7 @@ SOURCE_FILE@0..88
|
||||||
PATH_SEGMENT@10..23
|
PATH_SEGMENT@10..23
|
||||||
NAME_REF@10..13
|
NAME_REF@10..13
|
||||||
IDENT@10..13 "Foo"
|
IDENT@10..13 "Foo"
|
||||||
TYPE_ARG_LIST@13..23
|
GENERIC_ARG_LIST@13..23
|
||||||
L_ANGLE@13..14 "<"
|
L_ANGLE@13..14 "<"
|
||||||
TYPE_ARG@14..22
|
TYPE_ARG@14..22
|
||||||
PATH_TYPE@14..22
|
PATH_TYPE@14..22
|
||||||
|
|
|
@ -208,7 +208,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc {
|
||||||
"LIFETIME_PARAM",
|
"LIFETIME_PARAM",
|
||||||
"TYPE_PARAM",
|
"TYPE_PARAM",
|
||||||
"CONST_PARAM",
|
"CONST_PARAM",
|
||||||
"TYPE_ARG_LIST",
|
"GENERIC_ARG_LIST",
|
||||||
"LIFETIME_ARG",
|
"LIFETIME_ARG",
|
||||||
"TYPE_ARG",
|
"TYPE_ARG",
|
||||||
"ASSOC_TYPE_ARG",
|
"ASSOC_TYPE_ARG",
|
||||||
|
|
|
@ -1,3 +1,34 @@
|
||||||
|
Path =
|
||||||
|
(qualifier:Path '::')? segment:PathSegment
|
||||||
|
|
||||||
|
PathSegment =
|
||||||
|
'crate' | 'self' | 'super'
|
||||||
|
| '::' NameRef
|
||||||
|
| NameRef GenericArgList?
|
||||||
|
| NameRef ParamList RetType?
|
||||||
|
| '<' PathType ('as' PathType)? '>'
|
||||||
|
|
||||||
|
GenericArgList =
|
||||||
|
'::'? '<' (GenericArg (',' GenericArg)* ','?)? '>'
|
||||||
|
|
||||||
|
GenericArg =
|
||||||
|
TypeArg
|
||||||
|
| AssocTypeArg
|
||||||
|
| LifetimeArg
|
||||||
|
| ConstArg
|
||||||
|
|
||||||
|
TypeArg =
|
||||||
|
Type
|
||||||
|
|
||||||
|
AssocTypeArg =
|
||||||
|
NameRef (':' TypeBoundList | '=' Type)
|
||||||
|
|
||||||
|
LifetimeArg =
|
||||||
|
'lifetime'
|
||||||
|
|
||||||
|
ConstArg =
|
||||||
|
Expr
|
||||||
|
|
||||||
SourceFile =
|
SourceFile =
|
||||||
'shebang'?
|
'shebang'?
|
||||||
Attr*
|
Attr*
|
||||||
|
@ -318,7 +349,7 @@ ArgList =
|
||||||
'(' args:(Expr (',' Expr)* ','?)? ')'
|
'(' args:(Expr (',' Expr)* ','?)? ')'
|
||||||
|
|
||||||
MethodCallExpr =
|
MethodCallExpr =
|
||||||
Attr* Expr '.' NameRef TypeArgList? ArgList
|
Attr* Expr '.' NameRef GenericArgList? ArgList
|
||||||
|
|
||||||
FieldExpr =
|
FieldExpr =
|
||||||
Attr* Expr '.' NameRef
|
Attr* Expr '.' NameRef
|
||||||
|
@ -521,33 +552,6 @@ MacroStmts =
|
||||||
statements:Stmt*
|
statements:Stmt*
|
||||||
Expr?
|
Expr?
|
||||||
|
|
||||||
Path =
|
|
||||||
(qualifier:Path '::')? segment:PathSegment
|
|
||||||
|
|
||||||
PathSegment =
|
|
||||||
'::' | 'crate' | 'self' | 'super'
|
|
||||||
| '<' NameRef TypeArgList ParamList RetType PathType '>'
|
|
||||||
|
|
||||||
TypeArgList =
|
|
||||||
'::'? '<'
|
|
||||||
TypeArg*
|
|
||||||
LifetimeArg*
|
|
||||||
AssocTypeArg*
|
|
||||||
ConstArg*
|
|
||||||
'>'
|
|
||||||
|
|
||||||
TypeArg =
|
|
||||||
Type
|
|
||||||
|
|
||||||
AssocTypeArg =
|
|
||||||
NameRef (':' TypeBoundList | '=' Type)
|
|
||||||
|
|
||||||
LifetimeArg =
|
|
||||||
'lifetime'
|
|
||||||
|
|
||||||
ConstArg =
|
|
||||||
Literal | BlockExpr BlockExpr
|
|
||||||
|
|
||||||
Pat =
|
Pat =
|
||||||
OrPat
|
OrPat
|
||||||
| ParenPat
|
| ParenPat
|
||||||
|
|
Loading…
Reference in a new issue