about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-01 18:37:28 +0000
committerbors <bors@rust-lang.org>2019-04-01 18:37:28 +0000
commitf694222887cf31f51e68927716c25736e62f037f (patch)
treeb772c64e479866855dfe82986e3d92868a116852 /src/libsyntax/parse
parent9ebf47851a357faa4cd97f4b1dc7835f6376e639 (diff)
parente9b9f33ecc54eaebef0edaf0b26e5e32e2ded9c2 (diff)
downloadrust-f694222887cf31f51e68927716c25736e62f037f.tar.gz
rust-f694222887cf31f51e68927716c25736e62f037f.zip
Auto merge of #59606 - Centril:rollup, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #58507 (Add a -Z time option which prints only passes which runs once)
 - #58919 (Suggest using anonymous lifetime in `impl Trait` return)
 - #59041 (fixes rust-lang#56766)
 - #59586 (Fixed URL in cargotest::TEST_REPOS)
 - #59595 (Update rustc-guide submodule)
 - #59601 (Fix small typo)
 - #59603 (stabilize ptr::hash)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index ae8e57d54de..37360a56395 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -6722,6 +6722,22 @@ impl<'a> Parser<'a> {
             self.expect(&token::OpenDelim(token::Brace))?;
             let mut trait_items = vec![];
             while !self.eat(&token::CloseDelim(token::Brace)) {
+                if let token::DocComment(_) = self.token {
+                    if self.look_ahead(1,
+                    |tok| tok == &token::Token::CloseDelim(token::Brace)) {
+                        let mut err = self.diagnostic().struct_span_err_with_code(
+                            self.span,
+                            "found a documentation comment that doesn't document anything",
+                            DiagnosticId::Error("E0584".into()),
+                        );
+                        err.help("doc comments must come before what they document, maybe a \
+                            comment was intended with `//`?",
+                        );
+                        err.emit();
+                        self.bump();
+                        continue;
+                    }
+                }
                 let mut at_end = false;
                 match self.parse_trait_item(&mut at_end) {
                     Ok(item) => trait_items.push(item),