Skip to content

Commit

Permalink
Parse trailing dot or question on braced macro invocation
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Sep 23, 2021
1 parent 9122197 commit 13b7dba
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/stmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 0 additions & 4 deletions tests/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 13b7dba

Please sign in to comment.