Skip to content

Commit 0e96c28

Browse files
committed
libsyntax: restore lost error message
1 parent c8da569 commit 0e96c28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4726,9 +4726,13 @@ impl<'a> Parser<'a> {
47264726
let fields = try!(self.parse_record_struct_body(&class_name));
47274727
(fields, None)
47284728
// Tuple-style struct definition with optional where-clause.
4729-
} else {
4729+
} else if self.token == token::OpenDelim(token::Paren) {
47304730
let fields = try!(self.parse_tuple_struct_body(&class_name, &mut generics));
47314731
(fields, Some(ast::DUMMY_NODE_ID))
4732+
} else {
4733+
let token_str = self.this_token_to_string();
4734+
return Err(self.fatal(&format!("expected `where`, `{}`, `(`, or `;` after struct \
4735+
name, found `{}`", "{", token_str)))
47324736
};
47334737

47344738
Ok((class_name,

0 commit comments

Comments
 (0)