Skip to content

Commit

Permalink
Allow call to macro named "default" at item level
Browse files Browse the repository at this point in the history
The parser was too agressive and did reject any line beginning with
default even if this was a macro call.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Relax constraints
	around default identifier at item scope to accept "default" macros.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
  • Loading branch information
P-E-P authored and CohenArthur committed Oct 17, 2023
1 parent ba0fb41 commit 948523a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gcc/rust/parse/rust-parse-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,8 @@ Parser<ManagedTokenSource>::parse_item (bool called_from_statement)
return parse_vis_item (std::move (outer_attrs));
// or should this go straight to parsing union?
}
else if (t->get_str () == "default")
else if (t->get_str () == "default"
&& lexer.peek_token (1)->get_id () != EXCLAM)
{
add_error (Error (t->get_locus (),
"%qs is only allowed on items within %qs blocks",
Expand Down

0 comments on commit 948523a

Please sign in to comment.