Commit 151b109
committed
Revise
The section here stated:
> Matching against a slice pattern 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`.
It then goes on to state exceptions for arrays matched against slice
patterns and slice patterns containing only a rest pattern.
As we saw in an earlier commit, it's better to not lean on the reader
to infer the "relevant place" or when the length needs to be
inspected. Let's elaborate those details and state the full rule in
one go, upfront, and then state a separate guarantee that matching an
array against a slice pattern does not do a read. We'll also fix a
typo, add rule identifiers, fix a statement in an example about what
exactly is captured, and tighten up the examples generally....discriminants.slice-patterns-* rules1 parent 1719573 commit 151b109
1 file changed
+25
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
365 | 365 | | |
366 | 366 | | |
367 | 367 | | |
368 | | - | |
369 | | - | |
| 368 | + | |
| 369 | + | |
370 | 370 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
376 | 380 | | |
377 | | - | |
| 381 | + | |
378 | 382 | | |
379 | 383 | | |
380 | 384 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
387 | 390 | | |
388 | | - | |
| 391 | + | |
389 | 392 | | |
390 | 393 | | |
391 | 394 | | |
392 | | - | |
| 395 | + | |
| 396 | + | |
393 | 397 | | |
394 | | - | |
395 | | - | |
396 | | - | |
397 | | - | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
398 | 402 | | |
399 | | - | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
0 commit comments