Commit Graph

10 Commits

Author SHA1 Message Date
Alexander Regueiro 0a413975f5 Re-added accidentally removed test method.
Also fixed indentation.
2016-02-05 22:56:44 +00:00
Alexander Regueiro 9845491060 Added ArrayString::from constructor that takes string slice.
Also added corresponding test.
2016-02-05 22:30:24 +00:00
bluss 62d372ce1f Add DerefMut for ArrayString 2016-01-13 13:01:13 +01:00
bluss c73d5fa203 Implement Error trait for CapacityError 2015-09-20 13:02:08 +02:00
bluss 6af588cb2c ArrayString: Add PartialEq, Eq, Hash, and tests 2015-09-18 00:52:17 +02:00
bluss def1be54ed Add test for Write 2015-09-10 19:49:37 +02:00
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
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 5c50c4dbc7 Add method .into_inner() 2015-06-22 16:35:21 +02:00
root 196a9d60b6 Move tests to tests/ directory 2015-05-25 02:35:52 +02:00