Skip to content

Commit eb0e85c

Browse files
lucbfP-E-P
authored andcommitted
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]>
1 parent f942905 commit eb0e85c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

gcc/rust/parse/rust-parse-impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1861,7 +1861,8 @@ Parser<ManagedTokenSource>::parse_macro_invocation_semi (
18611861

18621862
t = lexer.peek_token ();
18631863
// parse token trees until the initial delimiter token is found again
1864-
while (!token_id_matches_delims (t->get_id (), delim_type))
1864+
while (!token_id_matches_delims (t->get_id (), delim_type)
1865+
&& t->get_id () != END_OF_FILE)
18651866
{
18661867
std::unique_ptr<AST::TokenTree> tree = parse_token_tree ();
18671868

0 commit comments

Comments
 (0)