diff options
-rw-r--r-- | gcc/rust/parse/rust-parse-impl.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/rust/compile/issue-1807.rs | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index 48ac521a867..b3b1bb218d6 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -10949,7 +10949,7 @@ Parser<ManagedTokenSource>::parse_reference_pattern () } // parse pattern to get reference of (required) - std::unique_ptr<AST::Pattern> pattern = parse_pattern (); + std::unique_ptr<AST::Pattern> pattern = parse_pattern_no_alt (); if (pattern == nullptr) { Error error (lexer.peek_token ()->get_locus (), diff --git a/gcc/testsuite/rust/compile/issue-1807.rs b/gcc/testsuite/rust/compile/issue-1807.rs new file mode 100644 index 00000000000..fe821f0fc90 --- /dev/null +++ b/gcc/testsuite/rust/compile/issue-1807.rs @@ -0,0 +1,6 @@ +// { dg-additional-options "-fsyntax-only" } + +fn main() { + let is_zero = &|&&d: &&u8| -> bool { d == b'0' }; + let lambda = |&c| c != b'9'; +} |