about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2017-11-24 07:34:24 -0800
committerEsteban Küber <esteban@kuber.com.ar>2017-11-24 08:32:01 -0800
commitf103342b8f63e6e88992749b5d0a49995bad5d48 (patch)
treed8e893af67e4e296147e87c3ad90f5792f14e16f /src/libsyntax/parse
parent0e93b75d27050e175c8ca1b401fa2f69378b378a (diff)
downloadrust-f103342b8f63e6e88992749b5d0a49995bad5d48.tar.gz
rust-f103342b8f63e6e88992749b5d0a49995bad5d48.zip
Consume trailing doc comments to avoid parse errors
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/parser.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d3104e0a553..e88c3c828db 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -5422,9 +5422,8 @@ impl<'a> Parser<'a> {
             token::CloseDelim(token::Brace) => {}
             token::DocComment(_) => {
                 let mut err = self.span_fatal_err(self.span, Error::UselessDocComment);
-                if self.eat(&token::Comma) ||
-                    self.look_ahead(1, |t| *t == token::CloseDelim(token::Brace))
-                {
+                self.bump(); // consume the doc comment
+                if self.eat(&token::Comma) || self.token == token::CloseDelim(token::Brace) {
                     err.emit();
                 } else {
                     return Err(err);