Commit bf18ed4
sync: fix panic in
`Chan::recv_many` intends to assert that no slots
have been consumed when exiting with `Ready` via
the `rx_closed` code path.
Instead of asserting no items were added to the
buffer, it asserted buffer emptiness, incorrectly
making assumptions about the provided buffer.
When `recv_many` was called on an empty channel
with idle semaphore after the receiver was closed,
the method would panic.
The branch coverage had been previously missing.
This changeset corrects the assertion
and adds tests covering the code path.
Fixes #7990.Chan::recv_many when called with non-empty vector on closed channel (#7991)1 parent f320197 commit bf18ed4
2 files changed
Lines changed: 29 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | | - | |
| 309 | + | |
312 | 310 | | |
313 | 311 | | |
314 | 312 | | |
315 | | - | |
| 313 | + | |
316 | 314 | | |
317 | 315 | | |
318 | 316 | | |
| |||
380 | 378 | | |
381 | 379 | | |
382 | 380 | | |
383 | | - | |
384 | | - | |
385 | | - | |
| 381 | + | |
386 | 382 | | |
387 | 383 | | |
388 | 384 | | |
389 | | - | |
| 385 | + | |
390 | 386 | | |
391 | 387 | | |
392 | 388 | | |
| |||
415 | 411 | | |
416 | 412 | | |
417 | 413 | | |
418 | | - | |
| 414 | + | |
419 | 415 | | |
420 | 416 | | |
421 | 417 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
358 | 358 | | |
359 | 359 | | |
360 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
361 | 385 | | |
362 | 386 | | |
363 | 387 | | |
| |||
0 commit comments