https://gcc.gnu.org/g:910bae566ebff5142688971792d13dc5d7274b88
commit r16-5603-g910bae566ebff5142688971792d13dc5d7274b88 Author: LĂșcio Boari Fleury <[email protected]> Date: Fri Nov 21 22:04:25 2025 -0300 gccrs: stop an infinite loop at END_OF_FILE gcc/rust/ChangeLog: * parse/rust-parse-impl.h: Add early exit condition to parsing loop. Signed-off-by: LĂșcio Boari Fleury <[email protected]> Diff: --- gcc/rust/parse/rust-parse-impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 0421d6cb80e5..afc701230951 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -1861,7 +1861,8 @@ Parser<ManagedTokenSource>::parse_macro_invocation_semi ( t = lexer.peek_token (); // parse token trees until the initial delimiter token is found again - while (!token_id_matches_delims (t->get_id (), delim_type)) + while (!token_id_matches_delims (t->get_id (), delim_type) + && t->get_id () != END_OF_FILE) { std::unique_ptr<AST::TokenTree> tree = parse_token_tree ();
