Commit Graph

425 Commits

Author SHA1 Message Date
Matt Brubeck a70033101f Version 1.8.0
* Add optional support for the `arbitrary` crate (#275).
2022-01-13 16:11:27 -08:00
bors-servo d61005924c Auto merge of #275 - as-com:arbitrary-support, r=mbrubeck
Add support for arbitrary

This PR adds optional support for [Arbitrary](https://github.com/rust-fuzz/arbitrary/), which is helpful in fuzz testing. The implementation is nearly identical to Arbitrary's existing Vec implementation.
2022-01-13 19:05:20 -05:00
Andrew Sun 0d8b2e7b4b Add support for arbitrary 2022-01-13 01:42:22 -05:00
bors-servo 83c3ef273b Auto merge of #271 - saethlin:drain-aliasing-test, r=jdm
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:54:40 -05:00
Ben Kimock f96cdfd269 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
Josh Matthews 82719fb11d Merge pull request #270 from servo/github-actions
Replace TravisCI with Github Actions.
2021-11-21 14:08:20 -05:00
Josh Matthews d01fa06412 Replace TravisCI with Github Actions. 2021-11-21 13:57:30 -05:00
Ben Kimock 1403de85a2 Include the cost of shifts in insert/remove benchmarks (#268)
Thanks!
2021-10-09 17:08:35 -07:00
Matt Brubeck 9af24f97df Version 1.7.0 2021-09-28 10:46:32 -07:00
Tim Lundqvist 1afe49373c Added feature const_new which enables SmallVec::new_const() (#265) 2021-09-28 10:44:16 -07:00
mgr-inz-rafal 5f24029b5f Fix typo 2021-08-28 17:05:10 +02:00
bors-servo b06fce929f Auto merge of #262 - Yamakaky:clone_from, r=mbrubeck
Add specialized `clone_from` implementation
2021-05-23 13:21:58 -04:00
Mikaël Fourrier 79607b6f24 Add specialized clone_from implementation 2021-05-23 18:05:39 +02:00
bors-servo 326780d9f8 Auto merge of #261 - mbrubeck:docs, r=jdm
Update docs for const_generics feature

This feature is stable in Rust 1.51.
2021-03-29 00:26:58 -04:00
Matt Brubeck 3926236712 Update docs for const_generics feature
This feature is stable in Rust 1.51.
2021-03-23 16:31:58 -07:00
bors-servo 1abefb46dc Auto merge of #259 - mbrubeck:overflow, r=emilio
Panic on arithmetic overflow in drain

Fixes #258.
2021-03-23 12:32:32 -04:00
Matt Brubeck 3085177aeb Panic on arithmetic overflow in drain
Fixes #258.
2021-03-23 09:31:58 -07:00
bors-servo 1dad48dece Auto merge of #254 - mbrubeck:overflow, r=emilio
Fix potential buffer overflow in `insert_many`

Fixes #252.
2021-01-08 12:20:39 -05:00
Matt Brubeck 529a214762 Fix potential buffer overflow in insert_many
Fixes #252.
2021-01-08 09:19:37 -08:00
bors-servo fae1f5ffcb Auto merge of #249 - mbrubeck:bump, r=jdm
Version 1.6.0

Release notes:

* The `union` feature is now compatible with stable Rust 1.49 (#248, #247).
* Fixed warnings when compiling with Rust 1.51 nightly (#242, #246).
2020-12-31 14:17:04 -05:00
Matt Brubeck c27ce0178e 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
bors-servo 5f045899b0 Auto merge of #248 - saethlin:master, r=mbrubeck
Wrap with ManuallyDrop so that the union feature works on 1.50

Per https://github.com/servo/rust-smallvec/issues/247#issuecomment-752794872

The unrelated diff was produced by rustfmt, which my editor runs automatically. I'm a bit surprised, usually when this produces a diff it's a big one. Do you want me to revert those lines?
2020-12-30 19:57:46 -05:00
Ben Kimock 9baac4efb5 make union feature work on 1.50 2020-12-30 19:48:06 -05:00
bors-servo 0f0a969948 Auto merge of #246 - mbrubeck:warnings, r=jdm
Silence warnings about deprecated LayoutErr

This is renamed to LayoutError in Rust 1.51 and later, but we need to continue using the old name to support older versions of Rust.
2020-12-30 10:09:59 -05:00
Matt Brubeck 535a4de0de Silence warnings about deprecated LayoutErr 2020-12-29 20:32:28 -08:00
bors-servo e1eb1ec274 Auto merge of #242 - c410-f3r:patch-2, r=mbrubeck
Remove `min_const_generics` feature

Depends on https://github.com/rust-lang/rust/pull/79135.

If #240 is already under development and will be available before the 1.50 release, then feel free to close this PR. Otherwise, the feature removal will benefit upstream projects in the meanwhile.
2020-12-28 17:27:44 -05:00
bors-servo 50f5c2b976 Auto merge of #244 - mbrubeck:bump, r=jdm
Version 1.5.1

Release notes:

* Improve performance of `push` (#241).
2020-12-04 17:12:47 -05:00
Matt Brubeck 5d64a860e2 Version 1.5.1
Release notes:

* Improve performance of `push` (#241).
2020-12-04 13:39:49 -08:00
Caio 10fb570fb6 Remove min_const_generics feature 2020-12-02 14:34:27 -03:00
bors-servo ded260001d Auto merge of #241 - mpdn:master, r=mbrubeck
Remove extraneous branch from push

`push` does two branches on the "smallness" of the `smallvec`: one before the reserve check and one after. LLVM doesn't seem to optimize the second branch away for the (very common) non-growing case. In addition, in the growing branch we know the memory will be on the heap, so no need to branch here.

On my machine, this improves `bench_push` from approx 300ns to 263ns (+/- 5 on both).
2020-11-30 13:54:49 -05:00
Mike Pedersen c50a800c63 Remove extraneous branch from push 2020-11-30 19:23:26 +01:00
bors-servo 305ada1bdc Auto merge of #239 - mbrubeck:bump, r=jdm
Version 1.5.0

Change log:

* Add the `append` method (#237).
* Add support for more array sizes between 17 and 31 (#234).
* Don't panic on deserialization errors (#238).
2020-11-16 20:39:46 -05:00
Matt Brubeck 26f0d922a6 Version 1.5.0
Change log:

* Add the `append` method (#237).
* Add support for more array sizes between 17 and 31 (#234).
* Don't panic on deserialization errors (#238).
2020-11-16 10:25:41 -08:00
bors-servo 2abcb42939 Auto merge of #238 - epilys:master, r=mbrubeck
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.

I happened upon this error when deserializing untrusted data with bincode. Bincode provides a byte limit bound but for sequences it's not possible to enforce this through serde since collection types like smallvec handle their own allocation.
2020-11-08 18:59:27 -05:00
Manos Pitsidianakis 29941ba95c 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
bors-servo 271e8d082c Auto merge of #237 - mbrubeck:append, r=jdm
Add SmallVec::append method

Fixes #236.
2020-10-22 10:22:06 -04:00
Matt Brubeck 42b4e91e0f Add SmallVec::append method
Fixes #236.
2020-10-21 09:40:26 -07:00
bors-servo 3a085b52e8 Auto merge of #234 - thomcc:len_at_most_32, r=mbrubeck
Implement Array for all sizes <= 32

Most traits supported by arrays are fully supported for arrays in the Rust stdlib as for all sizes <= 32. I was surprised to find that `SmallVec<[T; 18]>` (I happen to know that 18 the maximum outside of obscure cases) isn't possible because smallvec::Array is not consistent with this pattern.

Of course, I don't actually need this — I can just choose another size, but it seems like it would be good/unsurprising to be a superset of libstd's choices here.
2020-09-08 16:28:14 -04:00
Matt Brubeck 9def79eaa8 Revert "Add cargo fmt to travis build config"
This reverts commit eed65addf8.
2020-09-08 13:26:40 -07:00
Thom Chiovoloni f8558b7b65 Implement Array for all sizes <= 32 2020-09-08 11:59:24 -07:00
bors-servo 31ac026bd5 Auto merge of #233 - mbrubeck:bump, r=jdm
Version 1.4.2

Changelog:

* `insert_many` no longer leaks elements if the provided iterator panics (#213).
* The unstable `const_generics` and `specialization` features are updated to work with the most recent nightly Rust toolchain (#232).
* Internal code cleanup (#229, #231).

This PR also changes the `author` field in `Cargo.toml` to "The Servo Project Developers".
2020-08-11 19:04:05 -04:00
Matt Brubeck cd32126e72 Version 1.4.2
* `insert_many` no longer leaks elements if the provided iterator panics (#213).
* The unstable `const_generics` and `specialization` features are
  updated to work with the most recent nightly Rust toolchain (#232).
* Internal code cleanup (#229, #231).
2020-08-11 15:27:07 -07:00
bors-servo 8f2005bea0 Auto merge of #232 - c410-f3r:patch-1, r=mbrubeck
Use min_const_generics
2020-08-11 12:08:53 -04:00
Caio 04373d11f1 Use min_const_generics 2020-08-08 21:47:30 -03:00
bors-servo 8db9f2daba Auto merge of #230 - Atul9:add-cargo-fmt-to-travis-config, r=mbrubeck
Add cargo fmt to travis build config

The build failure is fixed in this PR https://github.com/servo/rust-smallvec/pull/231 hence #231 should be merged first.
2020-07-13 13:31:06 -04:00
bors-servo 0edaaa0915 Auto merge of #231 - Atul9:cargo-fmt, r=mbrubeck
Format code using 'cargo fmt'
2020-07-13 13:11:24 -04:00
Atul Bhosale 149260d230 Format code using 'cargo fmt' 2020-07-11 22:22:56 +05:30
Atul Bhosale eed65addf8 Add cargo fmt to travis build config 2020-07-10 23:22:36 +05:30
bors-servo dbe12424ea Auto merge of #213 - mbrubeck:leak, r=jdm
Fix leak on panic in `insert_many`.

Fixes #208 and reverts the workaround added in #209. CC @RalfJung.
2020-07-08 17:20:56 -04:00
Matt Brubeck 13c568817c Fix leak on panic in insert_many.
Fixes #208.
2020-07-07 14:32:16 -07:00