Commit Graph

383 Commits

Author SHA1 Message Date
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
bors-servo 0d9f9348c9 Auto merge of #229 - mbrubeck:src, r=jdm
Move source files into src directory

This moves the `tests` module into a separate file, and moves all source files into a `src` directory, to conform with the default layout for Rust projects.
2020-07-07 15:57:14 -04:00
Matt Brubeck 117987f93e Move source files into src directory 2020-07-07 11:39:58 -07:00
bors-servo edd131c468 Auto merge of #228 - servo:zero, r=jdm
Don’t heap-allocate for zero-size items

Allocating zero bytes is Undefined Behavior.
CC https://github.com/servo/servo/pull/26304#issuecomment-653626058
2020-07-06 10:09:08 -04:00
Simon Sapin f15edfcd6e Don’t heap-allocate for zero-size items
Allocating zero bytes is Undefined Behavior.
CC https://github.com/servo/servo/pull/26304#issuecomment-653626058
2020-07-06 16:06:13 +02:00
bors-servo 90728d3a6b Auto merge of #227 - SamuelMarks:rustfmt, r=mbrubeck
[*.rs] rustfmt
2020-06-29 14:55:08 -04:00
Samuel Marks 3f40777228 [*.rs] rustfmt 2020-06-29 11:50:38 +10:00
bors-servo 65663fd560 Auto merge of #225 - mbrubeck:docs, r=emilio
Update and document serde support

* Document the optional 'serde' feature. Fixes #224.
* Disable unused serde features. This makes serde support compatible with `no_std`.
2020-06-07 00:53:29 -04:00
Matt Brubeck 3d9cc9a950 Document the optional 'serde' feature 2020-06-05 15:34:36 -07:00
Matt Brubeck 94872b71fd Disable unused serde features
This makes serde support compatible with no_std.
2020-06-05 13:18:40 -07:00
bors-servo 9bc08d6f1d Auto merge of #223 - Luro02:docs, r=emilio
Link to tracking issues for unstable features
2020-05-22 08:06:20 -04:00
Luro02 3987866a58 Link to tracking issues for unstable features 2020-05-22 09:53:22 +02:00
bors-servo a0581061a5 Auto merge of #222 - mbrubeck:unused_mut, r=emilio
Silence unused_mut warning on smallvec! macro with no args

None
2020-05-17 06:17:27 -04:00
Matt Brubeck a42ad0541f Silence unused_mut warning on smallvec! macro with no args 2020-05-16 10:20:28 -07:00
bors-servo 30bf0ae4e5 Auto merge of #221 - cuviper:crate-macro, r=mbrubeck
Make sure smallvec! is usable without being in scope

Macro recursion should use a `$crate` prefix to reliably find itself.
2020-05-06 19:29:49 -04:00
Josh Stone df6fb60f84 Make sure smallvec! is usable without being in scope
Macro recursion should use a `$crate` prefix to reliably find itself.
2020-05-06 15:20:57 -07:00
bors-servo cc63b0b1b6 Auto merge of #218 - l0calh05t:resize_with, r=mbrubeck
Add resize_with

`std::vec::Vec` added `resize_with` in Rust 1.33. This patch adds the equivalent to `SmallVec`.
2020-04-30 17:04:06 -04:00
l0calh05t 6fa922f81f Add resize_with 2020-04-30 16:31:27 +02:00
bors-servo 2a4f9a78cd Auto merge of #216 - Alexendoo:clone-slice-from, r=mbrubeck
Implement Clone using From

This allows using the specialization in clones when it's enabled
2020-04-25 13:01:44 -04:00
Alex Macleod 32c535a06d Implement Clone using From
This allows using the specialization in clones when it's enabled
2020-04-25 16:08:27 +01:00
bors-servo 50f66f8285 Auto merge of #211 - mbrubeck:deprecate, r=jdm
Deprecate and hide ExtendFromSlice trait

This trait is only needed for internal benchmarking and should not have been public.  It will be removed in version 2.0.
2020-04-23 13:00:19 -04:00
bors-servo c23471683e Auto merge of #214 - servo:try_reserve, r=nox
Add `try_reserve` and friends

This more cleanly replaces this hack adding fallible allocation from outside the crate:

https://github.com/servo/servo/blob/faa9dccfe8/components/fallible/lib.rs#L101-L163
2020-04-23 07:59:21 -04:00
Simon Sapin 62e90c9251 Early returns 2020-04-23 13:58:43 +02:00
Simon Sapin 125580a76d Use realloc when possible 2020-04-23 01:22:54 +02:00
Simon Sapin d9313a4ad6 Add try_reserve and friends 2020-04-23 01:22:54 +02:00
Simon Sapin 1d115c2463 Stop using Vec as an allocator 2020-04-23 01:22:54 +02:00
Matt Brubeck c76756b473 Deprecate and hide ExtendFromSlice trait
This trait is only needed for internal benchmarking and should not have
been public.  It will be removed in version 2.0.
2020-04-22 13:50:48 -07:00
bors-servo 3183a5d7da Auto merge of #212 - mbrubeck:fuzz, r=jdm
Fuzzing fixes for CI

None
2020-04-22 16:19:20 -04:00
Matt Brubeck e64617e2c2 Ignore fuzz target directory 2020-04-22 12:44:08 -07:00
Matt Brubeck c128efd31f Pin honggfuzz to 0.5.47 2020-04-22 12:42:04 -07:00
bors-servo d32ed9cf32 Auto merge of #209 - RalfJung:miri, r=mbrubeck
enable Miri leak checker

Works around https://github.com/servo/rust-smallvec/issues/208
2020-04-11 14:07:45 -04:00
Ralf Jung 4420fc3cc5 note the leak in insert_many docs 2020-04-11 09:11:35 +02:00
Ralf Jung fdb73f8497 manually clean up leaked Boxes, to enable Miri's leak checker 2020-04-11 09:10:43 +02:00
bors-servo 571c965015 Auto merge of #207 - mbrubeck:bump, r=mbrubeck
Version 1.3.0

* Add a new unstable `const_generics` feature (#204).
* Improve inlining of constructor functions (#206).
* Add a `slice.to_smallvec()` convenience method (#203).
* Documentation and testing improvements.
2020-04-08 16:17:15 -04:00
Matt Brubeck 26f38e885f Version 1.3.0
* Add a new unstable `const_generics` feature (#204).
* Improve inlining of constructor functions (#206).
* Add a `slice.to_smallvec()` convenience method (#203).
* Documentation and testing improvements.
2020-04-05 19:13:20 -07:00
Matt Brubeck dbe47a7e58 Document Cargo features 2020-04-05 19:13:15 -07:00
Matt Brubeck b613bc48c2 Make ToSmallVec trait public 2020-04-05 17:33:35 -07:00
bors-servo 88c32dfc0e Auto merge of #206 - hiddenhare:inline-constructors, r=mbrubeck
Add #[inline] attribute to all fns which return SmallVec

When rustc fails to inline a `SmallVec` constructor, it can carry a significant performance cost: for example, if `SmallVec::<[i64; 128]>::from_iter(...)` fails to inline, it will perform an unnecessary 1kb memcpy.

I've recently been bitten by this when using `SmallVec` in a context where rustc seemed to be reluctant to perform inlining (a large fn with nested closures). Switching from `SmallVec::from_iter` to `SmallVec::new` and `push`, with a buffer size of 256 bytes, saved over 20ns per call. For larger buffers, `from_iter` carried a proportionally higher cost, even when the actual capacity in use didn't change.
2020-04-05 00:43:32 -04:00
hiddenhare 402db2503a Add #[inline] attribute to all fns which return SmallVec 2020-04-04 11:37:58 +01:00
bors-servo beae6234a7 Auto merge of #204 - c410-f3r:const__generics, r=mbrubeck
Add support for constant generics

No breaking changes and no internal hacks. This PR only adds a feature to switch between implementations of the `Array` trait.

I personally think that this approach is pretty reasonable and should be at least considered for discussion.
2020-03-18 01:34:05 -04:00
bors-servo 14576573f3 Auto merge of #205 - c410-f3r:fix-ci, r=mbrubeck
Fix CI

Pin `cargo install honggfuzz` version to match the same version of `Cargo.toml`
2020-03-17 22:44:45 -04:00
Caio bcfe84a5fa Fix CI 2020-03-17 19:32:21 -03:00
Caio 33f69cd0a6 Add support for constant generics 2020-03-17 17:37:31 -03:00