From: Pierre-Emmanuel Patry Date: Tue, 10 Oct 2023 12:36:35 +0000 (+0200) Subject: gccrs: Allow call to macro named "default" at item level X-Git-Tag: basepoints/gcc-15~2093 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1e039d2f848a97994f909e239a0d4e17f8933f46;p=thirdparty%2Fgcc.git gccrs: Allow call to macro named "default" at item level 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 --- diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index dde3d63201e2..1a042661568b 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -1133,7 +1133,8 @@ Parser::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",