From 4c92de44cde1bdd8d0fcb8a19adafd529d6c759c Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Sun, 18 Jul 2021 22:12:20 +0200 Subject: [PATCH] Remove error handling in parse_type_no_bounds for PLUS token parse_type_no_bounds tries to be helpful and greedily looks for a PLUS token after having parsed a typepath so it can produce an error. But that error breaks parsing expressions that contain "as" Cast Expressions like "a as usize + b as usize". Drop the explicit error on seeing a PLUS token and just return the type path parsed. --- gcc/rust/parse/rust-parse-impl.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index eedc76db43e..a0607926950 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -9996,13 +9996,6 @@ Parser::parse_type_no_bounds () std::move (tok_tree)), {}, locus)); } - case PLUS: - // type param bounds - not allowed, here for error message - add_error (Error (t->get_locus (), - "type param bounds (in TraitObjectType) are not " - "allowed as TypeNoBounds")); - - return nullptr; default: // assume that this is a type path and not an error return std::unique_ptr ( -- 2.32.0