diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-04-03 15:13:15 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-03 15:13:15 +0100 |
commit | 6a2dd7bafc24ac405aebf29f04120ca071019e92 (patch) | |
tree | ac21306c7bf9dc816f4b0e9b50322f57256eddfa /xtask/src | |
parent | 795b8cf9c5a6f3be4117823c896f41d1a4455079 (diff) | |
parent | da8eb29a2f70a58122903bf087bd6c1d0fbd6d3f (diff) |
Merge #3836
3836: Macro patterns are not confused with expressions. r=matklad a=matklad
We treat macro calls as expressions (there's appropriate Into impl),
which causes problem if there's expresison and non-expression macro in
the same node (like in the match arm).
We fix this problem by nesting macor patterns into another node (the
same way we nest path into PathExpr or PathPat). Ideally, we probably
should add a similar nesting for macro expressions, but that needs
some careful thinking about macros in blocks: `{ am_i_expression!() }`.
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'xtask/src')
-rw-r--r-- | xtask/src/ast_src.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 99bd60198..d9f51ec39 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -138,6 +138,7 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
138 | "SLICE_PAT", | 138 | "SLICE_PAT", |
139 | "RANGE_PAT", | 139 | "RANGE_PAT", |
140 | "LITERAL_PAT", | 140 | "LITERAL_PAT", |
141 | "MACRO_PAT", | ||
141 | // atoms | 142 | // atoms |
142 | "TUPLE_EXPR", | 143 | "TUPLE_EXPR", |
143 | "ARRAY_EXPR", | 144 | "ARRAY_EXPR", |
@@ -440,6 +441,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
440 | struct SlicePat { args: [Pat] } | 441 | struct SlicePat { args: [Pat] } |
441 | struct RangePat {} | 442 | struct RangePat {} |
442 | struct LiteralPat { Literal } | 443 | struct LiteralPat { Literal } |
444 | struct MacroPat { MacroCall } | ||
443 | 445 | ||
444 | struct RecordPat { RecordFieldPatList, Path } | 446 | struct RecordPat { RecordFieldPatList, Path } |
445 | struct RecordFieldPatList { | 447 | struct RecordFieldPatList { |
@@ -622,6 +624,7 @@ pub(crate) const AST_SRC: AstSrc = AstSrc { | |||
622 | SlicePat, | 624 | SlicePat, |
623 | RangePat, | 625 | RangePat, |
624 | LiteralPat, | 626 | LiteralPat, |
627 | MacroPat, | ||
625 | } | 628 | } |
626 | 629 | ||
627 | enum AttrInput { Literal, TokenTree } | 630 | enum AttrInput { Literal, TokenTree } |