diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-09-28 22:11:59 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-28 22:11:59 +0200 |
| commit | 55a3eada4dddefce8d28ab0435ce5e2f219946b4 (patch) | |
| tree | fcb3ab44293eea1db7efce773ac818f2cc39e3d1 /src/libsyntax | |
| parent | b18d8612c8e73604f0721449ce6126f80ad83a98 (diff) | |
| parent | 66c33c0e92c456ddec24c0b11475e912d1507934 (diff) | |
| download | rust-55a3eada4dddefce8d28ab0435ce5e2f219946b4.tar.gz rust-55a3eada4dddefce8d28ab0435ce5e2f219946b4.zip | |
Rollup merge of #64387 - nathanwhit:redundant-semi-fix, r=varkor
Fix redundant semicolon lint interaction with proc macro attributes Fixes #63967 and fixes #63947, both of which were caused by the lint's changes to the parser interacting poorly with proc macro attributes and causing span information to be lost r? @varkor
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index a5792dab474..4b9c2d13f26 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1657,9 +1657,18 @@ impl<'a> State<'a> { } } ast::StmtKind::Semi(ref expr) => { - self.space_if_not_bol(); - self.print_expr_outer_attr_style(expr, false); - self.s.word(";"); + match expr.kind { + // Filter out empty `Tup` exprs created for the `redundant_semicolon` + // lint, as they shouldn't be visible and interact poorly + // with proc macros. + ast::ExprKind::Tup(ref exprs) if exprs.is_empty() + && expr.attrs.is_empty() => (), + _ => { + self.space_if_not_bol(); + self.print_expr_outer_attr_style(expr, false); + self.s.word(";"); + } + } } ast::StmtKind::Mac(ref mac) => { let (ref mac, style, ref attrs) = **mac; |
