Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't leak on panic in extend #137

Merged
merged 1 commit into from Jan 4, 2019
Merged

Don't leak on panic in extend #137

merged 1 commit into from Jan 4, 2019

Conversation

@mbrubeck
Copy link
Contributor

mbrubeck commented Jan 4, 2019

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.


This change is Reviewable

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.
@jdm
Copy link
Member

jdm commented Jan 4, 2019

@bors-servo
Copy link
Contributor

bors-servo commented Jan 4, 2019

📌 Commit a9b8635 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Jan 4, 2019

Testing commit a9b8635 with merge 7ac360c...

bors-servo added a commit that referenced this pull request Jan 4, 2019
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 -->
@bors-servo
Copy link
Contributor

bors-servo commented Jan 4, 2019

☀️ Test successful - status-travis
Approved by: jdm
Pushing 7ac360c to master...

@bors-servo bors-servo merged commit a9b8635 into servo:master Jan 4, 2019
2 checks passed
2 checks passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
mbrubeck added a commit to mbrubeck/rust-smallvec that referenced this pull request Jan 19, 2019
Change log:

* Don't leak memory if an iterator panics during `extend` (servo#137)
* Update the unstable `union` feature for better forward compatibility (servo#135)
@mbrubeck mbrubeck mentioned this pull request Jan 19, 2019
bors-servo added a commit that referenced this pull request Jan 19, 2019
Version 0.6.8

Change log:

* Don't leak memory if an iterator panics during `extend` (#137)
* Update the unstable `union` feature for better forward compatibility (#135)

<!-- 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/138)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.