25 Commits

Author SHA1 Message Date
Nikita Popov b960b3ad31 Mark Array::size() as inline 2022-10-02 10:52:26 -07:00
Ridwan Abdilahi 09b4988a7a Add Natvis definitions and tests for SmallVec type with and without the union crate feature enabled.
Unify Natvis definitions into a single Natvis file.
2022-09-12 11:33:15 -07:00
Colin Rofls e9c2f0a63f Add retain_mut method (as an alias to retain)
I was trying to use this crate as a drop-in replacement for std::Vec,
where I am using the retain_mut method.
2022-06-29 16:02:53 -07:00
Nicholas Nethercote b2335682bc Optimize insert for the case where index == len.
By skipping the call to `copy` with a zero length. This makes it closer
to `push`. This speeds up rustc (which uses `SmallVec` extensively) by
2% on one benchmark.

Also clarify the panic condition.
2022-06-24 10:18:36 -07:00
Ben Kimock b257aad239 Fix Miri complaints with -Zmiri-tag-raw-pointers
Miri does not check all of Stacked Borrows (the prototype aliasing model
for Rust) without -Zmiri-tag-raw-pointers. This enables the check in CI,
and makes a few adjustments to fix places where pointers were
invalidated by construction or use of a mutable reference.
2022-02-01 18:29:18 -05:00
Andrew Sun 9bcd950f25 Add support for arbitrary 2022-01-13 01:42:22 -05:00
Ben Kimock 0fced9d92e Test for drains that shift the tail, when inline
Previously, the test suite only had one trip through the tail-shifting
code in Drain::drop, and that is in the heap state.
In the current implementation, a tail-shifting drain while in the inline
state produces potentially dangerous aliasing which is currently
accepted by default Miri and rejected with -Ztrack-raw-pointers.

Adding this test case ensures that if this ever becomes an actual
problem it will be easy to find.
2022-01-02 23:15:56 -05:00
Tim Lundqvist 1e4b151810 Added feature const_new which enables SmallVec::new_const() (#265) 2021-09-28 10:44:16 -07:00
mgr-inz-rafal 2691f3491a Fix typo 2021-08-28 17:05:10 +02:00
Mikaël Fourrier a2b19ce984 Add specialized clone_from implementation 2021-05-23 18:05:39 +02:00
Matt Brubeck 8419e95fe2 Update docs for const_generics feature
This feature is stable in Rust 1.51.
2021-03-23 16:31:58 -07:00
Matt Brubeck c3e7f21343 Panic on arithmetic overflow in drain
Fixes #258.
2021-03-23 09:31:58 -07:00
Matt Brubeck 9998ba0694 Fix potential buffer overflow in insert_many
Fixes #252.
2021-01-08 09:19:37 -08:00
Matt Brubeck 7ec5548c1b Version 1.6.0
Release notes:

* The `union` feature is now compatible with stable Rust 1.49 (#248).
* Fixed warnings when compiling with Rust 1.51 nightly (#242, #246).
2020-12-30 17:26:34 -08:00
Ben Kimock 2785548293 make union feature work on 1.50 2020-12-30 19:48:06 -05:00
Matt Brubeck d00f4d4736 Silence warnings about deprecated LayoutErr 2020-12-29 20:32:28 -08:00
Caio 2964a8469b Remove min_const_generics feature 2020-12-02 14:34:27 -03:00
Mike Pedersen 79f4132ba5 Remove extraneous branch from push 2020-11-30 19:23:26 +01:00
Manos Pitsidianakis d1394a0a52 Return allocation error in deserialize instead of panicking
There's no way to catch allocation errors since out of memory errors
cause an abort. Fail gracefully by returning the error instead of
panicking.
2020-11-08 20:10:44 +02:00
Matt Brubeck 592fc5a0e8 Add SmallVec::append method
Fixes #236.
2020-10-21 09:40:26 -07:00
Thom Chiovoloni 604b3feba3 Implement Array for all sizes <= 32 2020-09-08 11:59:24 -07:00
Caio 0e23d2a307 Use min_const_generics 2020-08-08 21:47:30 -03:00
Atul Bhosale 7f7ac30ef0 Format code using 'cargo fmt' 2020-07-11 22:22:56 +05:30
Matt Brubeck 8ddf61330d Fix leak on panic in insert_many.
Fixes #208.
2020-07-07 14:32:16 -07:00
Matt Brubeck d365521382 Move source files into src directory 2020-07-07 11:39:58 -07:00