diff options
| author | Saleem Jaffer <saleem@acko.com> | 2019-03-09 13:30:42 +0530 |
|---|---|---|
| committer | Saleem Jaffer <saleem@acko.com> | 2019-03-09 13:30:42 +0530 |
| commit | fcfc7963891db5c91035ea527ead2ef998d6781b (patch) | |
| tree | 3c12341a847a1b64894aa64f249f88b30a75fd43 /src/libsyntax/parse | |
| parent | 88f755f8a84df1d9e6b17cf10c96ae8b93481b2e (diff) | |
| download | rust-fcfc7963891db5c91035ea527ead2ef998d6781b.tar.gz rust-fcfc7963891db5c91035ea527ead2ef998d6781b.zip | |
fixes rust-lang#56766
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index fd5038a8614..5789d2d0920 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -6630,6 +6630,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), |
