about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-25 09:22:30 +0000
committerbors <bors@rust-lang.org>2019-04-25 09:22:30 +0000
commit112f7e9ac564e2cfcfc13d599c8376a219fde1bc (patch)
tree20a731f262d1bc4430449c3348fd803fc9379653 /src/libsyntax
parent3d720d7e617442aaf65df0910e8c9f0fdb0cf31c (diff)
parent0e505d427a573de2b1ba9d493171c2da0df9f12b (diff)
downloadrust-112f7e9ac564e2cfcfc13d599c8376a219fde1bc.tar.gz
rust-112f7e9ac564e2cfcfc13d599c8376a219fde1bc.zip
Auto merge of #60248 - estebank:macro-comma, r=oli-obk
Add guard for missing comma in macro call suggestion

Fix #60233. Follow up to #58796.

r? @oli-obk
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/tokenstream.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsyntax/tokenstream.rs b/src/libsyntax/tokenstream.rs
index 2d47b982ebd..93b5ecadd14 100644
--- a/src/libsyntax/tokenstream.rs
+++ b/src/libsyntax/tokenstream.rs
@@ -182,8 +182,10 @@ impl TokenStream {
                         (_, (TokenTree::Token(_, token::Token::Comma), _)) => continue,
                         ((TokenTree::Token(sp, token_left), NonJoint),
                          (TokenTree::Token(_, token_right), _))
-                        if (token_left.is_ident() || token_left.is_lit()) &&
-                            (token_right.is_ident() || token_right.is_lit()) => *sp,
+                        if ((token_left.is_ident() && !token_left.is_reserved_ident())
+                            || token_left.is_lit()) &&
+                            ((token_right.is_ident() && !token_right.is_reserved_ident())
+                            || token_right.is_lit()) => *sp,
                         ((TokenTree::Delimited(sp, ..), NonJoint), _) => sp.entire(),
                         _ => continue,
                     };