Skip to content

Commit 486ac8a

Browse files
committed
use valid let binding as example for parsing in assignment-like contexts
1 parent 5e826a0 commit 486ac8a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/3637-guard-patterns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,12 @@ Therefore guard patterns appearing at the top level in those places must also be
105105

106106
```rust
107107
// Not allowed:
108-
let x if guard(x) = foo() {}
108+
let x if guard(x) = foo() {} else { loop {} }
109109
if let x if guard(x) = foo() {}
110110
while let x if guard(x) = foo() {}
111111

112112
// Allowed:
113-
let (x if guard(x)) = foo() {} // Note that this would still error after parsing, since guard patterns are always refutable.
113+
let (x if guard(x)) = foo() {} else { loop {} }
114114
if let (x if guard(x)) = foo() {}
115115
while let (x if guard(x)) = foo() {}
116116
```

0 commit comments

Comments
 (0)