You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* New variables bound inside the `if let` guard (e.g., `y` in the example above) are available within the body of the match arm where the guard evaluates to `true`, but are not accessible in other arms or outside the match expression.
187
187
188
188
```rust
189
-
#![feature(if_let_guard)]
190
-
191
189
letopt=Some(42);
192
190
193
191
matchopt {
@@ -223,26 +221,23 @@ Before a guard (including an `if let` guard) is evaluated:
223
221
*Youcannotmovefromthescrutineeinsidetheguard.
224
222
*Newbindingscreatedinsidetheguard (e.g., via `ifletSome(y) =expr`) arelocaltotheguardanddonotpersistintothematcharmbody.
225
223
```rust
226
-
#![feature(if_let_guard)]
227
-
228
224
letval=Some(vec![1, 2, 3]);
229
-
225
+
230
226
letresult=matchval {
231
227
Some(v) ifletSome(_) =take(v) =>"ok", // ERROR: cannot move out of `v`
0 commit comments