From: Owen Avery Date: Sat, 2 Aug 2025 01:27:28 +0000 (-0400) Subject: gccrs: Catch parse failure in parse_path_meta_item X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2f054b8db9fa548443560a1187c998945fc9634a;p=thirdparty%2Fgcc.git gccrs: Catch parse failure in parse_path_meta_item gcc/rust/ChangeLog: * ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Catch parse_expr returning nullptr and remove defunct comment. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/ast/rust-ast.cc b/gcc/rust/ast/rust-ast.cc index 8918ef8a007..fd371ea0cd9 100644 --- a/gcc/rust/ast/rust-ast.cc +++ b/gcc/rust/ast/rust-ast.cc @@ -3713,9 +3713,12 @@ AttributeParser::parse_path_meta_item () skip_token (); std::unique_ptr expr = parser->parse_expr (); - // stream_pos++; - /* shouldn't be required anymore due to parsing literal actually - * skipping the token */ + + // handle error + // parse_expr should already emit an error and return nullptr + if (!expr) + return nullptr; + return std::unique_ptr ( new MetaItemPathExpr (std::move (path), std::move (expr))); }