Fixes https://github.com/Rust-GCC/gccrs/issues/4071.
gcc/rust/ChangeLog:
* parse/rust-parse-impl.h (Parser::parse_identifier_pattern):
Use parse_pattern_no_alt to parse identifier pattern
subpatterns.
(Parser::parse_ident_leading_pattern): Likewise.
gcc/testsuite/ChangeLog:
* rust/compile/parse_closure_bind.rs: New test.
Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
lexer.skip_token ();
// parse required pattern to bind
- bind_pattern = parse_pattern ();
+ bind_pattern = parse_pattern_no_alt ();
if (bind_pattern == nullptr)
{
Error error (lexer.peek_token ()->get_locus (),
// identifier with pattern bind
lexer.skip_token ();
- std::unique_ptr<AST::Pattern> bind_pattern = parse_pattern ();
+ std::unique_ptr<AST::Pattern> bind_pattern
+ = parse_pattern_no_alt ();
if (bind_pattern == nullptr)
{
Error error (
--- /dev/null
+// { dg-additional-options "-frust-compile-until=typecheck" }
+// TODO: this should typecheck
+
+#[lang = "sized"]
+trait Sized {}
+
+#[lang = "fn_once"]
+pub trait FnOnce<Args> {
+ /// The returned type after the call operator is used.
+ #[lang = "fn_once_output"]
+ type Output;
+
+ /// Performs the call operation.
+ extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
+}
+
+pub fn foo() {
+ (|_a @ _b| {}) (1)
+}