mirror of https://github.com/rust-lang/rfcs.git
clarify precedence of `if` relative to `|`
This commit is contained in:
parent
a84f01b0e2
commit
be09503e9c
|
@ -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.).
|
||||
|
|
Loading…
Reference in New Issue