From 64caa027b884b3458997318a01e99812e6bb6fca Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 20 Dec 2020 21:01:36 +0100 Subject: Parse attributes in tuple expressions --- crates/parser/src/grammar/expressions/atom.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'crates/parser/src/grammar') diff --git a/crates/parser/src/grammar/expressions/atom.rs b/crates/parser/src/grammar/expressions/atom.rs index 18b63feb7..e897d5a52 100644 --- a/crates/parser/src/grammar/expressions/atom.rs +++ b/crates/parser/src/grammar/expressions/atom.rs @@ -156,11 +156,13 @@ fn tuple_expr(p: &mut Parser) -> CompletedMarker { let mut saw_expr = false; while !p.at(EOF) && !p.at(T![')']) { saw_expr = true; - if !p.at_ts(EXPR_FIRST) { - p.error("expected expression"); + + // test tuple_attrs + // const A: (i64, i64) = (1, #[cfg(test)] 2); + if !expr_with_attrs(p) { break; } - expr(p); + if !p.at(T![')']) { saw_comma = true; p.expect(T![,]); -- cgit v1.2.3