Skip to content

Commit 68df7cf

Browse files
committed
Handle IDENTIFIER at parse_bare_function_type(
gcc/rust/ChangeLog: * parse/rust-parse-impl.h: new error Signed-off-by: Lúcio Boari Fleury <[email protected]>
1 parent 3a2432a commit 68df7cf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

gcc/rust/parse/rust-parse-impl.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9678,6 +9678,17 @@ Parser<ManagedTokenSource>::parse_bare_function_type (
96789678
if (!skip_token (FN_KW))
96799679
return nullptr;
96809680

9681+
auto t = lexer.peek_token ();
9682+
if (t->get_id () == IDENTIFIER)
9683+
{
9684+
Error error (t->get_locus (),
9685+
"unexpected token %qs - expected bare function",
9686+
t->get_token_description ());
9687+
add_error (std::move (error));
9688+
9689+
return nullptr;
9690+
}
9691+
96819692
if (!skip_token (LEFT_PAREN))
96829693
return nullptr;
96839694

@@ -9686,7 +9697,7 @@ Parser<ManagedTokenSource>::parse_bare_function_type (
96869697
bool is_variadic = false;
96879698
AST::AttrVec variadic_attrs;
96889699

9689-
const_TokenPtr t = lexer.peek_token ();
9700+
t = lexer.peek_token ();
96909701
while (t->get_id () != RIGHT_PAREN)
96919702
{
96929703
AST::AttrVec temp_attrs = parse_outer_attributes ();

0 commit comments

Comments
 (0)