Skip to content

Commit bcdc9f0

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 <lucboari@gmail.com>
1 parent 8f265dd commit bcdc9f0

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
@@ -9670,6 +9670,17 @@ Parser<ManagedTokenSource>::parse_bare_function_type (
96709670
if (!skip_token (FN_KW))
96719671
return nullptr;
96729672

9673+
auto t = lexer.peek_token ();
9674+
if (t->get_id () == IDENTIFIER)
9675+
{
9676+
Error error (t->get_locus (),
9677+
"unexpected token %qs - expected bare function",
9678+
t->get_token_description ());
9679+
add_error (std::move (error));
9680+
9681+
return nullptr;
9682+
}
9683+
96739684
if (!skip_token (LEFT_PAREN))
96749685
return nullptr;
96759686

@@ -9678,7 +9689,7 @@ Parser<ManagedTokenSource>::parse_bare_function_type (
96789689
bool is_variadic = false;
96799690
AST::AttrVec variadic_attrs;
96809691

9681-
const_TokenPtr t = lexer.peek_token ();
9692+
t = lexer.peek_token ();
96829693
while (t->get_id () != RIGHT_PAREN)
96839694
{
96849695
AST::AttrVec temp_attrs = parse_outer_attributes ();

0 commit comments

Comments
 (0)