Array expressions were being eagerly handled
outside of Pratt parsing.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h
(Parser<ManagedTokenSource>::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 <powerboat9.gamer@gmail.com>
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 */
--- /dev/null
+pub fn foo() {
+ [0, 1, 2][1];
+}
--- /dev/null
+fn main() -> i32 {
+ [55, 66, 77][1] - 66
+}