From 0ddec9f44d6ce81eec7aa62c2d9b13c9094e7857 Mon Sep 17 00:00:00 2001 From: Owen Avery Date: Mon, 27 Mar 2023 11:05:03 -0400 Subject: Fix parsing of array expressions. Array expressions were being eagerly handled outside of Pratt parsing. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_expr_without_block): Remove direct array expression handling. gcc/testsuite/ChangeLog: * rust/compile/array4.rs: New test. * rust/execute/torture/arrays.rs: New test. Signed-off-by: Owen Avery --- gcc/rust/parse/rust-parse-impl.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'gcc/rust') diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 79dd4e2..7c554e8 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -7449,9 +7449,6 @@ Parser::parse_expr_without_block ( case MOVE: // closure expr (though not all closure exprs require this) return parse_closure_expr (std::move (outer_attrs)); - case LEFT_SQUARE: - // array expr (creation, not index) - return parse_array_expr (std::move (outer_attrs)); default: { /* HACK: piggyback on pratt parsed expr and abuse polymorphism to * essentially downcast */ -- cgit v1.1