Commit Graph

411 Commits

Author SHA1 Message Date
bluss bf3b8c4f0f FIX: Unused code warning in array trait 2018-11-30 18:49:28 +01:00
bluss 226de4c9ba TEST: Add test for try_extend_from_slice's error 2018-11-30 18:48:43 +01:00
bluss ef7ab569b1 Merge pull request #112 from bluss/extend-improvement
Improve .extend() performance (?)
2018-11-28 17:01:41 +01:00
bluss fd98c6647d FEAT: Improved extend performance 2018-11-28 16:04:05 +01:00
bluss 675182bcbd TEST: Tweak extend benchmarks, add write benchmark
.write() is explicitly memcpy, so it's nice to compare with.
2018-11-28 16:04:05 +01:00
bluss fa95a80bbc FIX: Rename the extend_from_slice bench 2018-11-28 16:01:23 +01:00
bluss 47827e4843 FIX: Remake extend_from_slice to try_extend_from_slice
Do nothing and return an error, if the slice doesn't fit in the
remaining capacity.
2018-11-28 15:59:11 +01:00
bluss 8e5ff2d0fb FIX: Rename ArrayVec .capacity_left() → .remaining_capacity() 2018-11-28 15:52:46 +01:00
bluss d9222c0e61 Merge pull request #101 from Thomasdezeeuw/extend_from_slice
Add ArrayVec.extend_from_slice and capacity_left
2018-11-28 15:51:56 +01:00
Thomas de Zeeuw 8a8332f886 TEST: add benchmark for extend_from_slice 2018-11-26 13:06:06 +01:00
Thomas de Zeeuw c4b6e86211 REFAC: use extend_from_slice in Write implementation for ArrayVec 2018-11-26 12:59:30 +01:00
Thomas de Zeeuw 2120e4bb75 FEAT: Add ArrayVec.extend_from_slice 2018-11-26 12:59:30 +01:00
Thomas de Zeeuw d11c853346 FEAT: Add ArrayVec.capacity_left 2018-11-26 12:59:30 +01:00
bluss d84cb377a9 Merge pull request #111 from bluss/miri-complaints
Fix just a few stacked borrow issues, and improve extend performance
2018-11-25 17:17:43 +01:00
bluss f40e708f7c FIX: In truncate, don't access self while holding raw pointer derived from self
Again, stacked borrows model makes the `self.set_len()` call illegal
because we are holding (and are going to use) another raw pointer
derived from self, `tail`.
2018-11-25 16:37:29 +01:00
bluss 23128275ee TEST: Update benchmark for extend_from_slice
The benchmark was optimized out totally. We think of that as a good
sign, the new extend became transparent to the compiler and we had to
get smarter in how to fool it.
2018-11-25 16:34:47 +01:00
bluss 91e88a4976 FEAT: Simplify stack guard in extend
This simplification -- borrowing self.len instead of self, leads to
an improvement in the extend_from_slice benchmark.

It's also guided by the discussion of stacked borrows; the old code
would be invalid, because the whole self is borrowed while ptr is derived from
self.
2018-11-25 16:33:07 +01:00
bluss b1976641f3 MAINT: Test in travis from Rust 1.20 2018-11-25 10:44:23 +01:00
bluss 233df73ab2 Merge pull request #98 from bluss/use-drop-in-place
Use drop_in_place for truncate and clear (and drop)
2018-11-25 10:40:17 +01:00
bluss e80446c646 Merge pull request #102 from gnzlbg/ub
Fix undefined behavior in DerefMut of ArrayString
2018-11-25 10:34:54 +01:00
bluss 21034b357e Merge pull request #71 from clarcharr/master
Make zero-capacity ArrayVec a zero-sized type.
2018-11-25 10:34:12 +01:00
bluss 74f86a710e Merge branch 'master' into master 2018-11-25 10:29:22 +01:00
bluss c8d12cecb3 0.4.8 2018-11-25 09:46:33 +01:00
bluss f5adeab5f5 Merge pull request #109 from bluss/array-sizes-33-255
Add all array sizes 33-128 and 129-255 under a feature gate
2018-11-25 09:41:35 +01:00
bluss d77b93079f TEST: Add minimal tests for new array sizes 2018-11-25 09:36:22 +01:00
bluss e355c9eb31 DOC: Hide Array methods on impls
These just clutter up the docs. Most important that the users can see
the list of implemented array sizes, not the methods for each of those.
2018-11-25 09:32:29 +01:00
bluss 9d1ede62ea MAINT: Add Rust 1.22 to travis build 2018-11-25 09:26:01 +01:00
bluss 4dc503e17d MAINT: Add array sizes to travis build 2018-11-25 09:25:30 +01:00
bluss 50728e4cda DOC: Add doc for additional array features flags 2018-11-25 09:24:16 +01:00
bluss f1d73f4feb FEAT: Add array sizes 33 to 128 and 129 to 255 under feature flags
This way we cover all users up to 256 at least. The reason these are not
enabled by default is that they slow down the compilation of the crate
by a factor of 2-3x.
2018-11-25 09:22:51 +01:00
bluss 813e9dde42 MAINT: Update readme files for nodrop crates
Fixes #107
2018-11-12 22:26:20 +01:00
bluss 08c20edbb0 nodrop 0.1.13 2018-11-12 22:22:53 +01:00
bluss 0b63772902 nodrop-union 0.1.10 2018-11-12 22:22:36 +01:00
bluss 916f6781e4 Merge pull request #104 from clarcharr/clone_into_iter
Implement Clone, Debug for IntoIter
2018-10-30 19:51:06 +01:00
Clar Fon 2d3c2e3a0f Test IntoIter::clone 2018-10-28 18:45:11 -04:00
Clar Fon 46b64537cb Implement Clone, Debug for IntoIter 2018-10-28 18:45:11 -04:00
Clar Charr 55bedc922a Make zero-capacity ArrayVec a zero-sized type. 2018-10-14 17:25:45 -04:00
gnzlbg 9f57879028 fix undefined behavior in DerefMut of ArrayString 2018-08-31 22:43:05 +02:00
bluss ac61ce748b TEST: Fix drop tests for older Rust
In the test, test with Vec first to see how Rust implements panic
recovery while elements drop. If Vec drops all the elements, then we
test that arrayvec does too.
2018-03-25 23:49:42 +02:00
bluss 9db64d5948 FIX: Fix a typo in a comment 2018-03-25 23:26:20 +02:00
bluss 602e55dc67 FEAT: Use drop_in_place for truncate and clear (and drop)
This should perform better in both release and debug mode.

NOTE: This is significant because it changes the drop order of the
elements, and how we handle panicking destructors. If just one of the
destructors panic during ArrayVec drop, clear or truncate, the rest of
the elements should still drop. If we encounter another panic during
that process, however, Rust will abort as usual for panic during
unwinding.
2018-03-25 23:26:20 +02:00
bluss 3f9cdc52cd TEST: Add test that we drop all elements even if one of them panics 2018-03-25 23:26:20 +02:00
bluss 16aabf7c2c DOC: Fix typo in insert doc 2018-02-10 21:57:36 +01:00
bluss c1b72500cd REFAC Use clone_from_slice, extend in ArrayVec::clone_from
This is just a cleanup of the code, with less repetition.
2018-02-06 19:29:15 +01:00
bluss 0872a5946c 0.4.7 2018-01-17 20:45:50 +01:00
bluss 2eeed4bae5 Merge pull request #90 from jeehoonkang/rust-1.12.1
Support Rust 1.13.0
2018-01-17 20:35:36 +01:00
bluss bb92d72fd5 Merge pull request #91 from bluss/future-compat
FIX: Fix future compat warning with pointer casts
2018-01-17 20:33:41 +01:00
bluss a903e1a770 FIX: Fix future compat warning with pointer casts
```
warning: the type of this value must be known in this context
   --> src/lib.rs:312:32
    |
312 |                 ptr::copy(p, p.offset(1), len - index);
    |                                ^^^^^^
    |
    = note: #[warn(tyvar_behind_raw_pointer)] on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>
```
2018-01-17 20:25:47 +01:00
Jeehoon Kang 3df64ccd50 Support Rust 1.13.0 2018-01-16 15:04:45 +09:00
bluss ef133ef960 FIX: Use drop_in_place in IntoIter's drop. 2017-12-03 21:57:38 +01:00