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 drop twice on panic. #4

Closed
wants to merge 1 commit into from
Closed

Conversation

Stebalien
Copy link

No description provided.

@Stebalien
Copy link
Author

This is a fix for #3 but not necessarily the best fix.

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

I'm working on a fix too :) Let's compare..

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

I wonder which of these fixes are classified as the most fragile.

Thanks for submitting this PR by the way, made me understand this much better as a real panic safety bug.

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

I think the sane solution is to go back to using the external NoDrop with its own destructor (like arrayvec pre 0.3.8). That works, but do you think that's an accident?

@Stebalien
Copy link
Author

I think the sane solution is to go back to using the external NoDrop with its own destructor (like arrayvec pre 0.3.8).

That's what I did first. However, it makes the arrayvec one byte larger due to the drop flag...

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

One byte is just for the Arrayvec of u8. It makes it a whole element larger due to padding / alignment. It's an ok tradeoff for now..

@Stebalien
Copy link
Author

Also, that doesn't fix the IntoIter case (unless you put a NoDrop around the ArrayVec inside the IntoIter).

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

See PR /pull/6, it covers IntoIter too with some tweaks

@bluss
Copy link
Owner

bluss commented Aug 20, 2015

It is probably the case that panic on drop rules are simply not well defined. I'd prefer this guard case if it wasn't for the weird bug, which makes it feel very hacky.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants