[gcc r14-8048] gccrs: Fix RangeFromExpr parsing in for loops
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 18:14:05 GMT 2024
https://gcc.gnu.org/g:dff99b7464f8c2d35915d625e9e87ac92f7abc23
commit r14-8048-gdff99b7464f8c2d35915d625e9e87ac92f7abc23
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Tue Oct 10 13:11:55 2023 +0200
gccrs: Fix RangeFromExpr parsing in for loops
Those ranges were looking for a curly brace after the brace, leading
to an error when using range from expr in for loops.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_expr): Fix range from expr.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
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 1a042661568..63dea9836df 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -22,6 +22,7 @@
/* DO NOT INCLUDE ANYWHERE - this is automatically included with rust-parse.h
* This is also the reason why there are no include guards. */
+#include "rust-token.h"
#define INCLUDE_ALGORITHM
#include "rust-diagnostics.h"
#include "rust-make-unique.h"
@@ -12089,7 +12090,7 @@ Parser<ManagedTokenSource>::parse_expr (int right_binding_power,
{
TokenId id = current_token->get_id ();
if (id == SEMICOLON || id == RIGHT_PAREN || id == RIGHT_CURLY
- || id == RIGHT_SQUARE || id == COMMA)
+ || id == RIGHT_SQUARE || id == COMMA || id == LEFT_CURLY)
return nullptr;
}
More information about the Gcc-cvs
mailing list