Skip to content

Commit d636258

Browse files
committed
libsyntax: stop early enough if keyword is found instead of ident
fixes rust-lang#28439 The signature of public `check_strict_keywords` is changed.
1 parent 0762f58 commit d636258

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/libsyntax/parse/parser.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ impl<'a> Parser<'a> {
545545
}
546546

547547
pub fn parse_ident(&mut self) -> PResult<ast::Ident> {
548-
self.check_strict_keywords();
548+
try!(self.check_strict_keywords());
549549
try!(self.check_reserved_keywords());
550550
match self.token {
551551
token::Ident(i, _) => {
@@ -640,13 +640,13 @@ impl<'a> Parser<'a> {
640640
}
641641

642642
/// Signal an error if the given string is a strict keyword
643-
pub fn check_strict_keywords(&mut self) {
643+
pub fn check_strict_keywords(&mut self) -> PResult<()> {
644644
if self.token.is_strict_keyword() {
645645
let token_str = self.this_token_to_string();
646-
let span = self.span;
647-
self.span_err(span,
648-
&format!("expected identifier, found keyword `{}`",
649-
token_str));
646+
Err(self.fatal(&format!("expected identifier, found keyword `{}`",
647+
token_str)))
648+
} else {
649+
Ok(())
650650
}
651651
}
652652

0 commit comments

Comments
 (0)