From 13b7dba1739807ad47dc38fa4dbd2ec143643d11 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Thu, 23 Sep 2021 15:44:19 -0700 Subject: [PATCH] Parse trailing dot or question on braced macro invocation --- src/stmt.rs | 6 +++++- tests/repo/mod.rs | 4 ---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/stmt.rs b/src/stmt.rs index 100a474d79..bab913fe9c 100644 --- a/src/stmt.rs +++ b/src/stmt.rs @@ -158,7 +158,11 @@ pub mod parsing { // expression statements. let ahead = input.fork(); if let Ok(path) = ahead.call(Path::parse_mod_style) { - if ahead.peek(Token![!]) && (ahead.peek2(token::Brace) || ahead.peek2(Ident)) { + if ahead.peek(Token![!]) + && (ahead.peek2(token::Brace) + && !(ahead.peek3(Token![.]) || ahead.peek3(Token![?])) + || ahead.peek2(Ident)) + { input.advance_to(&ahead); return stmt_mac(input, attrs, path); } diff --git a/tests/repo/mod.rs b/tests/repo/mod.rs index 496f534839..1176620c11 100644 --- a/tests/repo/mod.rs +++ b/tests/repo/mod.rs @@ -12,10 +12,6 @@ const REVISION: &str = "ac2d9fc509e36d1b32513744adf58c34bcc4f43c"; #[rustfmt::skip] static EXCLUDE: &[&str] = &[ - // TODO: dot after curly braced macro call: macro!{...}.field - // https://github.com/dtolnay/syn/issues/1068 - "src/test/ui/parser/macro-braces-dot-question.rs", - // TODO: impl ~const T {} // https://github.com/dtolnay/syn/issues/1051 "src/test/ui/rfc-2632-const-trait-impl/syntax.rs",