Commit Graph

374 Commits

Author SHA1 Message Date
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
bors-servo 60747139cd Auto merge of #203 - UnicodingUnicorn:add-to_smallvec-to-slice, r=mbrubeck
added to_smallvec extension trait to slice primitive

Should resolve #116.
2020-02-24 11:00:57 -05:00
UnicodingUnicorn fb032e2533 added to_smallvec extension trait to slice primitive 2020-02-21 23:12:51 +08:00
bors-servo 1be529bcaa Auto merge of #199 - mbrubeck:bump, r=emilio
Version 1.2.0

Changes in this release:

* `IntoIter` now implements `Debug` (#196).
* `smallvec!` macro is now easier to use in `no_std` contexts where the `vec!` macro isn't automatically imported (#198).
2020-01-28 18:17:40 -05:00
Matt Brubeck c76230e526 Version 1.2.0
Changes in this release:

* `IntoIter` now implments `Debug` (#196).
* `smallvec!` macro is now easier to use in `no_std` contexts
   where the `vec!` macro isn't automatically imported (#198).
2020-01-27 20:27:28 -08:00
bors-servo 62781ba96e Auto merge of #198 - mbrubeck:macro, r=jdm
Use full path to vec! in smallvec! macro

Fixes #197
2020-01-27 19:03:35 -05:00
Matt Brubeck 8407c17332 Use full path to vec! in smallvec! macro
Fixes #197
2020-01-27 09:55:30 -08:00
bors-servo 91ef96cc6f Auto merge of #196 - Nemo157:intoiter-debug, r=mbrubeck
impl Debug for IntoIter

This has long been provided by `std::vec::IntoIter`, so is useful in cases where it is being directly replaced.
2020-01-27 11:53:57 -05:00
Wim Looman d930048d8d impl Debug for IntoIter 2020-01-24 14:09:20 +01:00
bors-servo 2bcd0c799a Auto merge of #193 - mbrubeck:bump, r=emilio
Version 1.1.0

Changes in this release:

* Added new method `SmallVec::into_boxed_slice` (#190).
* Added new methods `IntoIter::as_slice` and `as_mut_slice` (#182).
* `IntoIter` now implements `Clone` (#192).
* Improved documentation and testing (#186, #189).
* Minor code cleanups (#176).

Also added a simple example to the README.
2019-12-20 17:04:48 -05:00