summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-07-29 23:01:45 +0000
committerbors <bors@rust-lang.org>2017-07-29 23:01:45 +0000
commit53bf7903fa7ebabca85f5937667956177989e345 (patch)
treeec30eabce66b14bc4412ea97e3537ce975fed1c3 /src/libsyntax
parentcfe1668ca3ddb3dc57b1af319e258a16664486fa (diff)
parent3142ca0a6562ecf4653e2f1b1da19de6270322ec (diff)
downloadrust-53bf7903fa7ebabca85f5937667956177989e345.tar.gz
rust-53bf7903fa7ebabca85f5937667956177989e345.zip
Auto merge of #43009 - GuillaumeGomez:unused-doc-comments, r=nrc
Throw errors when doc comments are added where they're unused

#42617
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/ast.rs7
-rw-r--r--src/libsyntax/parse/parser.rs9
2 files changed, 11 insertions, 5 deletions
diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs
index fb791541524..2b28194c149 100644
--- a/src/libsyntax/ast.rs
+++ b/src/libsyntax/ast.rs
@@ -733,6 +733,13 @@ impl Stmt {
         };
         self
     }
+
+    pub fn is_item(&self) -> bool {
+        match self.node {
+            StmtKind::Local(_) => true,
+            _ => false,
+        }
+    }
 }
 
 impl fmt::Debug for Stmt {
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index 1a10aa9d621..1cb5a8111dc 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -2074,14 +2074,14 @@ impl<'a> Parser<'a> {
                 } else {
                     Ok(self.mk_expr(span, ExprKind::Tup(es), attrs))
                 }
-            },
+            }
             token::OpenDelim(token::Brace) => {
                 return self.parse_block_expr(lo, BlockCheckMode::Default, attrs);
-            },
-            token::BinOp(token::Or) |  token::OrOr => {
+            }
+            token::BinOp(token::Or) | token::OrOr => {
                 let lo = self.span;
                 return self.parse_lambda_expr(lo, CaptureBy::Ref, attrs);
-            },
+            }
             token::OpenDelim(token::Bracket) => {
                 self.bump();
 
@@ -2329,7 +2329,6 @@ impl<'a> Parser<'a> {
     pub fn parse_block_expr(&mut self, lo: Span, blk_mode: BlockCheckMode,
                             outer_attrs: ThinVec<Attribute>)
                             -> PResult<'a, P<Expr>> {
-
         self.expect(&token::OpenDelim(token::Brace))?;
 
         let mut attrs = outer_attrs;