From ade7a62e8f28c08569be358bf8af62f12c64dea8 Mon Sep 17 00:00:00 2001 From: kirtchev-adacore Date: Mon, 15 Dec 2025 11:35:44 +0200 Subject: [PATCH] Fix restrictions of or-patterns A small discrepancy in the definition of `or-patterns` was discovered during the `rust-lang/fls` meeting on 2025-12-12 involving Eric Huss and TC - `or-patterns` must not be used in function and closure **parameters**, as opposed to function and closure arguments as stated in the text. Function and closure parameters are the constructs carrying `PatternNoTopAlt`s. --- src/patterns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/patterns.md b/src/patterns.md index 2433c2545b..9a59e6f544 100644 --- a/src/patterns.md +++ b/src/patterns.md @@ -1059,7 +1059,7 @@ r[patterns.or] _Or-patterns_ are patterns that match on one of two or more sub-patterns (for example `A | B | C`). They can nest arbitrarily. -Syntactically, or-patterns are allowed in any of the places where other patterns are allowed (represented by the [Pattern] production), with the exceptions of `let`-bindings and function and closure arguments (represented by the [PatternNoTopAlt] production). +Syntactically, or-patterns are allowed in any of the places where other patterns are allowed (represented by the [Pattern] production), with the exceptions of `let`-bindings and function and closure parameters (represented by the [PatternNoTopAlt] production). r[patterns.constraints] ### Static semantics