diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-16 05:48:05 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-16 05:48:05 +0000 |
commit | 152f385055510c65bd94238878be23a258f5cc19 (patch) | |
tree | e8470eb83c1bc1283f0bb28ea01db789607a3140 /crates/parser/src/grammar | |
parent | c0a2b4e826e1da20d3cfa8c279fcdffa24f32a7d (diff) | |
parent | 8e07b23b84bff16c0decc6f2b80c27862eac6df1 (diff) |
Merge #8044
8044: Fix macro expansion for statements w/o semicolon r=edwin0cheng a=edwin0cheng
Fixes #7845
And up `ungrammer` to 1.12.
cc @jonas-schievink
bors r+
Co-authored-by: Edwin Cheng <[email protected]>
Diffstat (limited to 'crates/parser/src/grammar')
-rw-r--r-- | crates/parser/src/grammar/expressions.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/parser/src/grammar/expressions.rs b/crates/parser/src/grammar/expressions.rs index 5f885edfd..0d9dc9348 100644 --- a/crates/parser/src/grammar/expressions.rs +++ b/crates/parser/src/grammar/expressions.rs | |||
@@ -54,7 +54,7 @@ fn is_expr_stmt_attr_allowed(kind: SyntaxKind) -> bool { | |||
54 | !forbid | 54 | !forbid |
55 | } | 55 | } |
56 | 56 | ||
57 | pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { | 57 | pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi, prefer_expr: bool) { |
58 | let m = p.start(); | 58 | let m = p.start(); |
59 | // test attr_on_expr_stmt | 59 | // test attr_on_expr_stmt |
60 | // fn foo() { | 60 | // fn foo() { |
@@ -90,7 +90,7 @@ pub(super) fn stmt(p: &mut Parser, with_semi: StmtWithSemi) { | |||
90 | p.error(format!("attributes are not allowed on {:?}", kind)); | 90 | p.error(format!("attributes are not allowed on {:?}", kind)); |
91 | } | 91 | } |
92 | 92 | ||
93 | if p.at(T!['}']) { | 93 | if p.at(T!['}']) || (prefer_expr && p.at(EOF)) { |
94 | // test attr_on_last_expr_in_block | 94 | // test attr_on_last_expr_in_block |
95 | // fn foo() { | 95 | // fn foo() { |
96 | // { #[A] bar!()? } | 96 | // { #[A] bar!()? } |
@@ -198,7 +198,7 @@ pub(super) fn expr_block_contents(p: &mut Parser) { | |||
198 | continue; | 198 | continue; |
199 | } | 199 | } |
200 | 200 | ||
201 | stmt(p, StmtWithSemi::Yes) | 201 | stmt(p, StmtWithSemi::Yes, false) |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||