Commit 7ac360c
bors-servo
Auto merge of #137 - mbrubeck:extend, r=jdm
Don't leak on panic in extend
This ensures that the length of the SmallVec is updated even if the iterator panics in `next`.
This uses `SetLenOnDrop` rather than setting the length inside the loop, because otherwise this suffers from the same optimization issue as rust-lang/rust#36355.
Fixes #136.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/137)
<!-- Reviewable:end -->1 file changed
+10
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1340 | 1340 | | |
1341 | 1341 | | |
1342 | 1342 | | |
1343 | | - | |
1344 | | - | |
1345 | | - | |
1346 | | - | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
1347 | 1346 | | |
1348 | | - | |
1349 | | - | |
| 1347 | + | |
| 1348 | + | |
1350 | 1349 | | |
1351 | 1350 | | |
1352 | 1351 | | |
1353 | 1352 | | |
1354 | | - | |
1355 | 1353 | | |
1356 | 1354 | | |
1357 | 1355 | | |
| |||
1560 | 1558 | | |
1561 | 1559 | | |
1562 | 1560 | | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
1563 | 1566 | | |
1564 | 1567 | | |
1565 | 1568 | | |
| |||
0 commit comments