From 3bb46042fb5b8ee421e350c54079cb68b4edc996 Mon Sep 17 00:00:00 2001 From: John Renner Date: Fri, 1 May 2020 08:59:24 -0700 Subject: Validate uses of self and super --- xtask/src/ast_src.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xtask') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index c14804aad..1abb62f6f 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -595,7 +595,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { qualifier: Path, } struct PathSegment { - T![::], T![crate], T![<], NameRef, TypeArgList, ParamList, RetType, PathType, T![>] + T![::], T![crate], T![self], T![super], T![<], NameRef, TypeArgList, ParamList, RetType, PathType, T![>] } struct TypeArgList { T![::], -- cgit v1.2.3 From fd030f9450ed6910677e30f8fa65b06e71fcffa2 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 01:12:37 +0200 Subject: Revert "Merge #4233" This reverts commit a5f2b16366f027ad60c58266a66eb7fbdcbda9f9, reversing changes made to c96b2180c1c4206a0a98c280b4d30897eb116336. --- xtask/src/ast_src.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'xtask') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 703fb9be9..1abb62f6f 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -162,6 +162,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "RECORD_LIT", "RECORD_FIELD_LIST", "RECORD_FIELD", + "TRY_BLOCK_EXPR", "BOX_EXPR", // postfix "CALL_EXPR", @@ -439,6 +440,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { } struct IfExpr: AttrsOwner { T![if], Condition } struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] } + struct TryBlockExpr: AttrsOwner { T![try], body: BlockExpr } struct ForExpr: AttrsOwner, LoopBodyOwner { T![for], Pat, @@ -449,7 +451,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } struct Label { T![lifetime] } - struct BlockExpr: AttrsOwner { Label, T![unsafe], T![async], Block } + struct BlockExpr: AttrsOwner { Label, T![unsafe], T![async], Block } struct ReturnExpr: AttrsOwner { Expr } struct CallExpr: ArgListOwner { Expr } struct MethodCallExpr: AttrsOwner, ArgListOwner { @@ -720,6 +722,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { FieldExpr, AwaitExpr, TryExpr, + TryBlockExpr, CastExpr, RefExpr, PrefixExpr, -- cgit v1.2.3 From 4f2134cc33f07c09fe166cec42971828843bc0ef Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sat, 2 May 2020 01:18:19 +0200 Subject: Introduce EffectExpr --- xtask/src/ast_src.rs | 19 +++++++------------ xtask/src/codegen/gen_syntax.rs | 1 + 2 files changed, 8 insertions(+), 12 deletions(-) (limited to 'xtask') diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 1abb62f6f..028f7cbe1 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs @@ -162,7 +162,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "RECORD_LIT", "RECORD_FIELD_LIST", "RECORD_FIELD", - "TRY_BLOCK_EXPR", + "EFFECT_EXPR", "BOX_EXPR", // postfix "CALL_EXPR", @@ -177,7 +177,6 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { "PREFIX_EXPR", "RANGE_EXPR", // just weird "BIN_EXPR", - "BLOCK", "EXTERN_BLOCK", "EXTERN_ITEM_LIST", "ENUM_VARIANT", @@ -440,7 +439,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { } struct IfExpr: AttrsOwner { T![if], Condition } struct LoopExpr: AttrsOwner, LoopBodyOwner { T![loop] } - struct TryBlockExpr: AttrsOwner { T![try], body: BlockExpr } + struct EffectExpr: AttrsOwner { Label, T![try], T![unsafe], T![async], BlockExpr } struct ForExpr: AttrsOwner, LoopBodyOwner { T![for], Pat, @@ -451,7 +450,9 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { struct ContinueExpr: AttrsOwner { T![continue], T![lifetime] } struct BreakExpr: AttrsOwner { T![break], T![lifetime], Expr } struct Label { T![lifetime] } - struct BlockExpr: AttrsOwner { Label, T![unsafe], T![async], Block } + struct BlockExpr: AttrsOwner, ModuleItemOwner { + T!['{'], statements: [Stmt], Expr, T!['}'], + } struct ReturnExpr: AttrsOwner { Expr } struct CallExpr: ArgListOwner { Expr } struct MethodCallExpr: AttrsOwner, ArgListOwner { @@ -460,7 +461,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { struct IndexExpr: AttrsOwner { T!['['], T![']'] } struct FieldExpr: AttrsOwner { Expr, T![.], NameRef } struct AwaitExpr: AttrsOwner { Expr, T![.], T![await] } - struct TryExpr: AttrsOwner { T![try], Expr } + struct TryExpr: AttrsOwner { Expr, T![?] } struct CastExpr: AttrsOwner { Expr, T![as], TypeRef } struct RefExpr: AttrsOwner { T![&], T![raw], T![mut], Expr } struct PrefixExpr: AttrsOwner { /*PrefixOp,*/ Expr } @@ -556,12 +557,6 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { T![;], } struct Condition { T![let], Pat, T![=], Expr } - struct Block: AttrsOwner, ModuleItemOwner { - T!['{'], - statements: [Stmt], - Expr, - T!['}'], - } struct ParamList { T!['('], SelfParam, @@ -722,7 +717,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { FieldExpr, AwaitExpr, TryExpr, - TryBlockExpr, + EffectExpr, CastExpr, RefExpr, PrefixExpr, diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index e9dc09552..8028575c5 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs @@ -432,6 +432,7 @@ impl Field<'_> { ":" => "colon", "::" => "coloncolon", "#" => "pound", + "?" => "question_mark", _ => name, }; format_ident!("{}_token", name) -- cgit v1.2.3