clarify precedence of `if` relative to `|`

This commit is contained in:
Max Niederman 2024-05-15 23:08:06 -07:00
parent a84f01b0e2
commit be09503e9c
No known key found for this signature in database
GPG Key ID: C2EB24390E0AC0FF
1 changed files with 1 additions and 0 deletions

View File

@ -90,6 +90,7 @@ false if (foo | true)
```
For that reason, guard patterns nested within or-patterns must be explicitly parenthesized.
Otherwise, the `|` will be parsed as a bitwise OR to maintain backwards compatability with match arm guards.
There's a similar ambiguity between `=` used as the assignment operator within the guard
and used outside to indicate assignment to the pattern (e.g. in `if`-`let`, `while let`, etc.).