From: LĂșcio Boari Fleury <[email protected]>

gcc/rust/ChangeLog:

        * parse/rust-parse-impl.h: Add early exit condition to parsing loop.

Signed-off-by: LĂșcio Boari Fleury <[email protected]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/rust-GCC/gccrs/commit/eb0e85c8da749d14b8999f048194ac822db9c680
 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 0421d6cb8..afc701230 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 ();
 

base-commit: f942905bb493f3450e92303d2376aadf56711f2b
-- 
2.51.2

Reply via email to