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
Matching against a [slice pattern][patterns.slice] performs a read if the slice pattern needs to inspect the length of the scrutinee. The read will cause the closure to borrow the relevant place by `ImmBorrow`.
343
+
Matching against a [slice pattern][patterns.slice]that needs to inspect the length of the scrutinee performs a read of the pointer value in order to fetch the length. The read will cause the closure to borrow the relevant place by `ImmBorrow`.
344
344
345
345
```rust,compile_fail,E0506
346
346
let x: &mut [i32] = &mut [1, 2, 3];
@@ -352,7 +352,7 @@ x[0] += 1; // ERROR: cannot assign to `x[_]` because it is borrowed
352
352
c();
353
353
```
354
354
355
-
As such, matching against an array doesn't itself cause any borrows, as the lengthh is fixed and doesn't need to be read.
355
+
As such, matching against an array doesn't itself cause any borrows, as the lengthh is fixed and the pattern doesn't need to inspect it.
0 commit comments