Skip to content

Commit d925c41

Browse files
committed
made change
1 parent bf22e9c commit d925c41

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/expressions/match-expr.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,9 @@ Before a guard (including an `if let` guard) is evaluated:
217217
}
218218
```
219219
2. Guard evaluation happens after that, and:
220-
* It runs using a shared borrow of the scrutinee
221-
* You cannot move from the scrutinee inside the guard.
222-
* New bindings created inside the guard (e.g., via `if let Some(y) = expr`) are local to the guard and do not persist into the match arm body.
220+
* Guard evaluation follows successful main pattern match. Variables bound by the main pattern are usable within the guard, respecting their binding type (borrow/move)
221+
* Moves from the scrutinee in the guard are subject to standard Rust ownership rules. Avoid moving what's needed later; already moved parts from the main pattern can be used.
222+
* Variables successfully bound within the if let guard are in scope within the corresponding match arm body. Their scope extends to the arm after the guard condition is met.
223223
```rust,ignore
224224
let val = Some(vec![1, 2, 3]);
225225

0 commit comments

Comments
 (0)