Commit Graph

69 Commits

Author SHA1 Message Date
bluss c35760e02c Use NoDrop to fix panic safety issues
ArrayVec::drop was not panic safe — if there would be a panic during an
element's drop, the discriminant would never be set to Dropped, and the
array elements would potentially double drop.

Fix this by going back to the old NoDrop composition. The NoDrop struct
thas its own Drop impl, that will trigger too on panic during an element's
drop. This serves to make ArrayVec::drop panic safe.

Also tweak IntoIter::drop to make it panic safe: set inner ArrayVec's
length before dropping any elements.

Thank you to @Stebalien for reporting this bug and providing the
excellent testcases in this commit.

Using NoDrop expands ArrayVec to have two drop flags again, but this
is a temporary tradeoff, drop flags will eventually go away.

Fixes #3
2015-08-20 22:33:01 +02:00
bluss 804fb9692a Add cargo test --release to the travis run 2015-08-20 22:26:49 +02:00
root b6d4d82808 arrayvec: Bump version 2015-07-30 16:52:55 +02:00
root 9e4bac559c arrayvec: Make nodrop purely a dev-dependency
We generate docs for it, but we don't need it.
2015-07-30 16:51:07 +02:00
root d4612de8f4 Add custom.css for docs 2015-07-30 16:49:57 +02:00
bluss 235320e393 Merge pull request #1 from bluss/nodrop
Nodrop
2015-07-30 16:19:57 +02:00
root d3728b654e Bump version 2015-07-30 16:16:42 +02:00
root cf273fec1f Use a non-dropping enum directly
Don't use NoDrop as a separate abstraction: Then we have two drop flags,
one for ArrayVec and one for NoDrop. Instead import the logic from
NoDrop. The result is a much smaller ArrayVec value.
2015-07-30 16:14:04 +02:00
root 3634fa4633 Bump version 2015-06-22 16:39:52 +02:00
root 5c50c4dbc7 Add method .into_inner() 2015-06-22 16:35:21 +02:00
root 66d5d9a12e Expose ArrayVec::set_len as a pub unsafe method 2015-06-22 00:17:23 +02:00
root 5ae6e1aadc arrayvec: Use odds 0.2 and bump version 2015-06-14 14:53:05 +02:00
root 221bfd9aa0 nodrop: Use newer odds & Bump version 2015-06-14 14:52:48 +02:00
root 1e97bde46a Makefile: proper versioning of all crates in docs 2015-06-14 14:48:17 +02:00
root ad22698464 arrayvec: Use odds & bump version 2015-06-02 17:30:59 +02:00
root 7c92874782 nodrop: Use odds & bump version 2015-06-02 17:28:04 +02:00
root 48fdc7e651 nodrop: Bump version 2015-05-26 17:10:02 +02:00
root 09cf5168f9 nodrop: Add no_drop_flag optional feature 2015-05-26 17:05:42 +02:00
root 07e497a2be arrayvec: Bump version 2015-05-25 13:46:26 +02:00
root 6081270cf3 Order & group methods logically for docs 2015-05-25 13:46:26 +02:00
root 196a9d60b6 Move tests to tests/ directory 2015-05-25 02:35:52 +02:00
root 11a864b6f7 Add test for Option<ArrayVec<_>> to be sure 2015-05-25 02:26:32 +02:00
root 8a154e9847 Use set_len() consistently and code cleanup 2015-05-25 00:26:17 +02:00
root 6d02ab3980 Test that Option<Flag<T>> doesn't apply any layout optimization 2015-05-24 23:53:02 +02:00
root 0e00fbccf1 Bump version 2015-05-23 13:04:03 +02:00
root 3d579a626d Improve .insert()'s removal of the last element 2015-05-23 12:53:35 +02:00
root 1eec0d4834 Make sure the methods on RangeArgument can be inlined 2015-05-23 12:43:45 +02:00
root 3175d97f80 Implement ArrayVec::clear 2015-05-23 03:12:38 +02:00
root e91a018220 Bump version 2015-05-23 01:07:50 +02:00
root be2979d87a Make sure methods in helper trait Index are inlined 2015-05-23 00:52:26 +02:00
root 37c0f53708 Add another testcase to insert 2015-05-23 00:52:26 +02:00
root d8d21dc14c Bump version 2015-05-22 20:22:50 +02:00
root ebf260ea90 Implement ArrayVec::insert 2015-05-22 20:18:01 +02:00
root d3b3fc16fb Implement array sizes in the 16-bit index range 2015-05-22 20:16:41 +02:00
root a268a5e25c Bump arrayvec version 2015-05-22 14:28:03 +02:00
root b4413e95b9 Bump nodrop version 2015-05-22 14:25:21 +02:00
root 8f8db4a3ed Implement ArrayVec::remove() and ::drain() 2015-05-22 14:22:43 +02:00
root 33e31b8ecf Implement ArrayVec::swap_remove 2015-05-22 13:49:44 +02:00
root 1b42f992ed Move Array trait to separate file
Also remove the ::new() method on the trait
2015-05-22 13:26:01 +02:00
root 00466e6efd Simplify drop test (Rc is redundant) 2015-05-21 16:04:38 +02:00
root 14550015d9 nodrop: Small improvement of into_inner 2015-05-21 16:04:11 +02:00
root a8bd594be2 Bump version 2015-05-21 11:58:00 +02:00
root 2b7ca83d84 Update readme 2015-05-21 11:57:12 +02:00
root 8047dc621c Use crate nodrop -- it moved to a separate crate 2015-05-21 11:54:46 +02:00
root c146002c83 Split out nodrop::NoDrop to its own crate 2015-05-21 11:53:05 +02:00
root 6e29c390ed Bump version 2015-05-20 17:22:19 +02:00
root 31f95d1818 Use #[repr(u8)] on the Flag enum 2015-05-20 17:17:17 +02:00
root 8730a3584b Move len last in the struct
Put len last so that it sits next to the drop flag (as of current rust)
which saves padding for element types with size_of > 1.
2015-05-20 17:17:17 +02:00
root 5b916cab16 Implement DoubleEndedIterator for ArrayVec 2015-05-20 17:17:17 +02:00
root ad4780704a Remove redundant imports 2015-05-20 17:17:17 +02:00