Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
This commit is contained in:
1
vendor/smallvec/.cargo-checksum.json
vendored
Normal file
1
vendor/smallvec/.cargo-checksum.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"files":{"Cargo.toml":"12129d19d241f8b8041854ed140f6bdfb05ec43742d0f80779e40b1b24365c79","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b28172679e0009b655da42797c03fd163a3379d5cfa67ba1f1655e974a2a1a9","README.md":"a01127c37308457e8d396b176fb790846be0978c173be3f13260b62efcef011b","benches/bench.rs":"d82015eae942ee5cf74ace8c3c260ee2c6b5bcbeeb87254d2c72622c747a708a","debug_metadata/README.md":"4d7f1c1b2c25ce2231ef71864d06e54323867459035b53bc9e00f66a0a44f82e","debug_metadata/smallvec.natvis":"3092ddebd8fffc3486536d7f27f8c5eae3a8a093d45cd8eeb3946ea2b0c35a15","scripts/run_miri.sh":"74a9f9adc43f986e81977b03846f7dd00122a0150bd8ec3fe4842a1a787e0f07","src/arbitrary.rs":"22e55cfbf60374945b30e6d0855129eff67cd8b878cef6fa997e1f4be67b9e3d","src/lib.rs":"fbae23a885178a0a8e1372e81e85fd9d65f4416f53ab489b1bde65854396ff48","src/specialization.rs":"46433586203399251cba496d67b88d34e1be3c2b591986b77463513da1c66471","src/tests.rs":"11c951cb4da40e13de1f7058e023cd29e857216e1e3243111a63ae79e931dbc6","tests/debugger_visualizer.rs":"185456ad253957fc0c9e904ff8a1135397ac991c29fa3c60f75d8d81f7463022","tests/macro.rs":"22ad4f6f104a599fdcba19cad8834105b8656b212fb6c7573a427d447f5db14f"},"package":"4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970"}
|
72
vendor/smallvec/Cargo.toml
vendored
Normal file
72
vendor/smallvec/Cargo.toml
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g., crates.io) dependencies.
|
||||
#
|
||||
# If you are reading this file be aware that the original Cargo.toml
|
||||
# will likely look very different (and much more reasonable).
|
||||
# See Cargo.toml.orig for the original contents.
|
||||
|
||||
[package]
|
||||
edition = "2018"
|
||||
name = "smallvec"
|
||||
version = "1.11.2"
|
||||
authors = ["The Servo Project Developers"]
|
||||
description = "'Small vector' optimization: store up to a small number of items on the stack"
|
||||
documentation = "https://docs.rs/smallvec/"
|
||||
readme = "README.md"
|
||||
keywords = [
|
||||
"small",
|
||||
"vec",
|
||||
"vector",
|
||||
"stack",
|
||||
"no_std",
|
||||
]
|
||||
categories = ["data-structures"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/servo/rust-smallvec"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
rustdoc-args = [
|
||||
"--cfg",
|
||||
"docsrs",
|
||||
"--generate-link-to-definition",
|
||||
]
|
||||
|
||||
[[test]]
|
||||
name = "debugger_visualizer"
|
||||
path = "tests/debugger_visualizer.rs"
|
||||
test = false
|
||||
required-features = ["debugger_visualizer"]
|
||||
|
||||
[dependencies.arbitrary]
|
||||
version = "1"
|
||||
optional = true
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1"
|
||||
optional = true
|
||||
default-features = false
|
||||
|
||||
[dev-dependencies.bincode]
|
||||
version = "1.0.1"
|
||||
|
||||
[dev-dependencies.debugger_test]
|
||||
version = "0.1.0"
|
||||
|
||||
[dev-dependencies.debugger_test_parser]
|
||||
version = "0.1.0"
|
||||
|
||||
[features]
|
||||
const_generics = []
|
||||
const_new = ["const_generics"]
|
||||
debugger_visualizer = []
|
||||
drain_filter = []
|
||||
drain_keep_rest = ["drain_filter"]
|
||||
may_dangle = []
|
||||
specialization = []
|
||||
union = []
|
||||
write = []
|
201
vendor/smallvec/LICENSE-APACHE
vendored
Normal file
201
vendor/smallvec/LICENSE-APACHE
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
25
vendor/smallvec/LICENSE-MIT
vendored
Normal file
25
vendor/smallvec/LICENSE-MIT
vendored
Normal file
@ -0,0 +1,25 @@
|
||||
Copyright (c) 2018 The Servo Project Developers
|
||||
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
26
vendor/smallvec/README.md
vendored
Normal file
26
vendor/smallvec/README.md
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
rust-smallvec
|
||||
=============
|
||||
|
||||
[Documentation](https://docs.rs/smallvec/)
|
||||
|
||||
[Release notes](https://github.com/servo/rust-smallvec/releases)
|
||||
|
||||
"Small vector" optimization for Rust: store up to a small number of items on the stack
|
||||
|
||||
## Example
|
||||
|
||||
```rust
|
||||
use smallvec::{SmallVec, smallvec};
|
||||
|
||||
// This SmallVec can hold up to 4 items on the stack:
|
||||
let mut v: SmallVec<[i32; 4]> = smallvec![1, 2, 3, 4];
|
||||
|
||||
// It will automatically move its contents to the heap if
|
||||
// contains more than four items:
|
||||
v.push(5);
|
||||
|
||||
// SmallVec points to a slice, so you can use normal slice
|
||||
// indexing and other methods to access its contents:
|
||||
v[0] = v[1] + v[2];
|
||||
v.sort();
|
||||
```
|
312
vendor/smallvec/benches/bench.rs
vendored
Normal file
312
vendor/smallvec/benches/bench.rs
vendored
Normal file
@ -0,0 +1,312 @@
|
||||
#![feature(test)]
|
||||
#![allow(deprecated)]
|
||||
|
||||
extern crate test;
|
||||
|
||||
use self::test::Bencher;
|
||||
use smallvec::{ExtendFromSlice, smallvec, SmallVec};
|
||||
|
||||
const VEC_SIZE: usize = 16;
|
||||
const SPILLED_SIZE: usize = 100;
|
||||
|
||||
trait Vector<T>: for<'a> From<&'a [T]> + Extend<T> + ExtendFromSlice<T> {
|
||||
fn new() -> Self;
|
||||
fn push(&mut self, val: T);
|
||||
fn pop(&mut self) -> Option<T>;
|
||||
fn remove(&mut self, p: usize) -> T;
|
||||
fn insert(&mut self, n: usize, val: T);
|
||||
fn from_elem(val: T, n: usize) -> Self;
|
||||
fn from_elems(val: &[T]) -> Self;
|
||||
}
|
||||
|
||||
impl<T: Copy> Vector<T> for Vec<T> {
|
||||
fn new() -> Self {
|
||||
Self::with_capacity(VEC_SIZE)
|
||||
}
|
||||
|
||||
fn push(&mut self, val: T) {
|
||||
self.push(val)
|
||||
}
|
||||
|
||||
fn pop(&mut self) -> Option<T> {
|
||||
self.pop()
|
||||
}
|
||||
|
||||
fn remove(&mut self, p: usize) -> T {
|
||||
self.remove(p)
|
||||
}
|
||||
|
||||
fn insert(&mut self, n: usize, val: T) {
|
||||
self.insert(n, val)
|
||||
}
|
||||
|
||||
fn from_elem(val: T, n: usize) -> Self {
|
||||
vec![val; n]
|
||||
}
|
||||
|
||||
fn from_elems(val: &[T]) -> Self {
|
||||
val.to_owned()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: Copy> Vector<T> for SmallVec<[T; VEC_SIZE]> {
|
||||
fn new() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
|
||||
fn push(&mut self, val: T) {
|
||||
self.push(val)
|
||||
}
|
||||
|
||||
fn pop(&mut self) -> Option<T> {
|
||||
self.pop()
|
||||
}
|
||||
|
||||
fn remove(&mut self, p: usize) -> T {
|
||||
self.remove(p)
|
||||
}
|
||||
|
||||
fn insert(&mut self, n: usize, val: T) {
|
||||
self.insert(n, val)
|
||||
}
|
||||
|
||||
fn from_elem(val: T, n: usize) -> Self {
|
||||
smallvec![val; n]
|
||||
}
|
||||
|
||||
fn from_elems(val: &[T]) -> Self {
|
||||
SmallVec::from_slice(val)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! make_benches {
|
||||
($typ:ty { $($b_name:ident => $g_name:ident($($args:expr),*),)* }) => {
|
||||
$(
|
||||
#[bench]
|
||||
fn $b_name(b: &mut Bencher) {
|
||||
$g_name::<$typ>($($args,)* b)
|
||||
}
|
||||
)*
|
||||
}
|
||||
}
|
||||
|
||||
make_benches! {
|
||||
SmallVec<[u64; VEC_SIZE]> {
|
||||
bench_push => gen_push(SPILLED_SIZE as _),
|
||||
bench_push_small => gen_push(VEC_SIZE as _),
|
||||
bench_insert_push => gen_insert_push(SPILLED_SIZE as _),
|
||||
bench_insert_push_small => gen_insert_push(VEC_SIZE as _),
|
||||
bench_insert => gen_insert(SPILLED_SIZE as _),
|
||||
bench_insert_small => gen_insert(VEC_SIZE as _),
|
||||
bench_remove => gen_remove(SPILLED_SIZE as _),
|
||||
bench_remove_small => gen_remove(VEC_SIZE as _),
|
||||
bench_extend => gen_extend(SPILLED_SIZE as _),
|
||||
bench_extend_small => gen_extend(VEC_SIZE as _),
|
||||
bench_from_iter => gen_from_iter(SPILLED_SIZE as _),
|
||||
bench_from_iter_small => gen_from_iter(VEC_SIZE as _),
|
||||
bench_from_slice => gen_from_slice(SPILLED_SIZE as _),
|
||||
bench_from_slice_small => gen_from_slice(VEC_SIZE as _),
|
||||
bench_extend_from_slice => gen_extend_from_slice(SPILLED_SIZE as _),
|
||||
bench_extend_from_slice_small => gen_extend_from_slice(VEC_SIZE as _),
|
||||
bench_macro_from_elem => gen_from_elem(SPILLED_SIZE as _),
|
||||
bench_macro_from_elem_small => gen_from_elem(VEC_SIZE as _),
|
||||
bench_pushpop => gen_pushpop(),
|
||||
}
|
||||
}
|
||||
|
||||
make_benches! {
|
||||
Vec<u64> {
|
||||
bench_push_vec => gen_push(SPILLED_SIZE as _),
|
||||
bench_push_vec_small => gen_push(VEC_SIZE as _),
|
||||
bench_insert_push_vec => gen_insert_push(SPILLED_SIZE as _),
|
||||
bench_insert_push_vec_small => gen_insert_push(VEC_SIZE as _),
|
||||
bench_insert_vec => gen_insert(SPILLED_SIZE as _),
|
||||
bench_insert_vec_small => gen_insert(VEC_SIZE as _),
|
||||
bench_remove_vec => gen_remove(SPILLED_SIZE as _),
|
||||
bench_remove_vec_small => gen_remove(VEC_SIZE as _),
|
||||
bench_extend_vec => gen_extend(SPILLED_SIZE as _),
|
||||
bench_extend_vec_small => gen_extend(VEC_SIZE as _),
|
||||
bench_from_iter_vec => gen_from_iter(SPILLED_SIZE as _),
|
||||
bench_from_iter_vec_small => gen_from_iter(VEC_SIZE as _),
|
||||
bench_from_slice_vec => gen_from_slice(SPILLED_SIZE as _),
|
||||
bench_from_slice_vec_small => gen_from_slice(VEC_SIZE as _),
|
||||
bench_extend_from_slice_vec => gen_extend_from_slice(SPILLED_SIZE as _),
|
||||
bench_extend_from_slice_vec_small => gen_extend_from_slice(VEC_SIZE as _),
|
||||
bench_macro_from_elem_vec => gen_from_elem(SPILLED_SIZE as _),
|
||||
bench_macro_from_elem_vec_small => gen_from_elem(VEC_SIZE as _),
|
||||
bench_pushpop_vec => gen_pushpop(),
|
||||
}
|
||||
}
|
||||
|
||||
fn gen_push<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn push_noinline<V: Vector<u64>>(vec: &mut V, x: u64) {
|
||||
vec.push(x);
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
for x in 0..n {
|
||||
push_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_insert_push<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn insert_push_noinline<V: Vector<u64>>(vec: &mut V, x: u64) {
|
||||
vec.insert(x as usize, x);
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
for x in 0..n {
|
||||
insert_push_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_insert<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn insert_noinline<V: Vector<u64>>(vec: &mut V, p: usize, x: u64) {
|
||||
vec.insert(p, x)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
// Always insert at position 0 so that we are subject to shifts of
|
||||
// many different lengths.
|
||||
vec.push(0);
|
||||
for x in 0..n {
|
||||
insert_noinline(&mut vec, 0, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_remove<V: Vector<u64>>(n: usize, b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn remove_noinline<V: Vector<u64>>(vec: &mut V, p: usize) -> u64 {
|
||||
vec.remove(p)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = V::from_elem(0, n as _);
|
||||
|
||||
for _ in 0..n {
|
||||
remove_noinline(&mut vec, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_extend<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
vec.extend(0..n);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_from_iter<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..n).collect();
|
||||
b.iter(|| {
|
||||
let vec = V::from(&v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_from_slice<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..n).collect();
|
||||
b.iter(|| {
|
||||
let vec = V::from_elems(&v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_extend_from_slice<V: Vector<u64>>(n: u64, b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..n).collect();
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
vec.extend_from_slice(&v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_pushpop<V: Vector<u64>>(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn pushpop_noinline<V: Vector<u64>>(vec: &mut V, x: u64) -> Option<u64> {
|
||||
vec.push(x);
|
||||
vec.pop()
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = V::new();
|
||||
for x in 0..SPILLED_SIZE as _ {
|
||||
pushpop_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
fn gen_from_elem<V: Vector<u64>>(n: usize, b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let vec = V::from_elem(42, n);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_insert_many(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn insert_many_noinline<I: IntoIterator<Item = u64>>(
|
||||
vec: &mut SmallVec<[u64; VEC_SIZE]>,
|
||||
index: usize,
|
||||
iterable: I,
|
||||
) {
|
||||
vec.insert_many(index, iterable)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec = SmallVec::<[u64; VEC_SIZE]>::new();
|
||||
insert_many_noinline(&mut vec, 0, 0..SPILLED_SIZE as _);
|
||||
insert_many_noinline(&mut vec, 0, 0..SPILLED_SIZE as _);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_insert_from_slice(b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..SPILLED_SIZE as _).collect();
|
||||
b.iter(|| {
|
||||
let mut vec = SmallVec::<[u64; VEC_SIZE]>::new();
|
||||
vec.insert_from_slice(0, &v);
|
||||
vec.insert_from_slice(0, &v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_macro_from_list(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let vec: SmallVec<[u64; 16]> = smallvec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 36, 0x40, 0x80,
|
||||
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000,
|
||||
0x80000, 0x100000,
|
||||
];
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_macro_from_list_vec(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let vec: Vec<u64> = vec![
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 36, 0x40, 0x80,
|
||||
0x100, 0x200, 0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000,
|
||||
0x80000, 0x100000,
|
||||
];
|
||||
vec
|
||||
});
|
||||
}
|
111
vendor/smallvec/debug_metadata/README.md
vendored
Normal file
111
vendor/smallvec/debug_metadata/README.md
vendored
Normal file
@ -0,0 +1,111 @@
|
||||
## Debugger Visualizers
|
||||
|
||||
Many languages and debuggers enable developers to control how a type is
|
||||
displayed in a debugger. These are called "debugger visualizations" or "debugger
|
||||
views".
|
||||
|
||||
The Windows debuggers (WinDbg\CDB) support defining custom debugger visualizations using
|
||||
the `Natvis` framework. To use Natvis, developers write XML documents using the natvis
|
||||
schema that describe how debugger types should be displayed with the `.natvis` extension.
|
||||
(See: https://docs.microsoft.com/en-us/visualstudio/debugger/create-custom-views-of-native-objects?view=vs-2019)
|
||||
The Natvis files provide patterns which match type names a description of how to display
|
||||
those types.
|
||||
|
||||
The Natvis schema can be found either online (See: https://code.visualstudio.com/docs/cpp/natvis#_schema)
|
||||
or locally at `<VS Installation Folder>\Xml\Schemas\1033\natvis.xsd`.
|
||||
|
||||
The GNU debugger (GDB) supports defining custom debugger views using Pretty Printers.
|
||||
Pretty printers are written as python scripts that describe how a type should be displayed
|
||||
when loaded up in GDB/LLDB. (See: https://sourceware.org/gdb/onlinedocs/gdb/Pretty-Printing.html#Pretty-Printing)
|
||||
The pretty printers provide patterns, which match type names, and for matching
|
||||
types, describe how to display those types. (For writing a pretty printer, see: https://sourceware.org/gdb/onlinedocs/gdb/Writing-a-Pretty_002dPrinter.html#Writing-a-Pretty_002dPrinter).
|
||||
|
||||
### Embedding Visualizers
|
||||
|
||||
Through the use of the currently unstable `#[debugger_visualizer]` attribute, the `smallvec`
|
||||
crate can embed debugger visualizers into the crate metadata.
|
||||
|
||||
Currently the two types of visualizers supported are Natvis and Pretty printers.
|
||||
|
||||
For Natvis files, when linking an executable with a crate that includes Natvis files,
|
||||
the MSVC linker will embed the contents of all Natvis files into the generated `PDB`.
|
||||
|
||||
For pretty printers, the compiler will encode the contents of the pretty printer
|
||||
in the `.debug_gdb_scripts` section of the `ELF` generated.
|
||||
|
||||
### Testing Visualizers
|
||||
|
||||
The `smallvec` crate supports testing debugger visualizers defined for this crate. The entry point for
|
||||
these tests are `tests/debugger_visualizer.rs`. These tests are defined using the `debugger_test` and
|
||||
`debugger_test_parser` crates. The `debugger_test` crate is a proc macro crate which defines a
|
||||
single proc macro attribute, `#[debugger_test]`. For more detailed information about this crate,
|
||||
see https://crates.io/crates/debugger_test. The CI pipeline for the `smallvec` crate has been updated
|
||||
to run the debugger visualizer tests to ensure debugger visualizers do not become broken/stale.
|
||||
|
||||
The `#[debugger_test]` proc macro attribute may only be used on test functions and will run the
|
||||
function under the debugger specified by the `debugger` meta item.
|
||||
|
||||
This proc macro attribute has 3 required values:
|
||||
|
||||
1. The first required meta item, `debugger`, takes a string value which specifies the debugger to launch.
|
||||
2. The second required meta item, `commands`, takes a string of new line (`\n`) separated list of debugger
|
||||
commands to run.
|
||||
3. The third required meta item, `expected_statements`, takes a string of new line (`\n`) separated list of
|
||||
statements that must exist in the debugger output. Pattern matching through regular expressions is also
|
||||
supported by using the `pattern:` prefix for each expected statement.
|
||||
|
||||
#### Example:
|
||||
|
||||
```rust
|
||||
#[debugger_test(
|
||||
debugger = "cdb",
|
||||
commands = "command1\ncommand2\ncommand3",
|
||||
expected_statements = "statement1\nstatement2\nstatement3")]
|
||||
fn test() {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
Using a multiline string is also supported, with a single debugger command/expected statement per line:
|
||||
|
||||
```rust
|
||||
#[debugger_test(
|
||||
debugger = "cdb",
|
||||
commands = "
|
||||
command1
|
||||
command2
|
||||
command3",
|
||||
expected_statements = "
|
||||
statement1
|
||||
pattern:statement[0-9]+
|
||||
statement3")]
|
||||
fn test() {
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
In the example above, the second expected statement uses pattern matching through a regular expression
|
||||
by using the `pattern:` prefix.
|
||||
|
||||
#### Testing Locally
|
||||
|
||||
Currently, only Natvis visualizations have been defined for the `smallvec` crate via `debug_metadata/smallvec.natvis`,
|
||||
which means the `tests/debugger_visualizer.rs` tests need to be run on Windows using the `*-pc-windows-msvc` targets.
|
||||
To run these tests locally, first ensure the debugging tools for Windows are installed or install them following
|
||||
the steps listed here, [Debugging Tools for Windows](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/).
|
||||
Once the debugging tools have been installed, the tests can be run in the same manner as they are in the CI
|
||||
pipeline.
|
||||
|
||||
#### Note
|
||||
|
||||
When running the debugger visualizer tests, `tests/debugger_visualizer.rs`, they need to be run consecutively
|
||||
and not in parallel. This can be achieved by passing the flag `--test-threads=1` to rustc. This is due to
|
||||
how the debugger tests are run. Each test marked with the `#[debugger_test]` attribute launches a debugger
|
||||
and attaches it to the current test process. If tests are running in parallel, the test will try to attach
|
||||
a debugger to the current process which may already have a debugger attached causing the test to fail.
|
||||
|
||||
For example:
|
||||
|
||||
```
|
||||
cargo test --test debugger_visualizer --features debugger_visualizer -- --test-threads=1
|
||||
```
|
35
vendor/smallvec/debug_metadata/smallvec.natvis
vendored
Normal file
35
vendor/smallvec/debug_metadata/smallvec.natvis
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||
<Type Name="smallvec::SmallVec<array$<*,*>>" Priority="Medium">
|
||||
<Intrinsic Name="is_inline" Expression="$T2 >= capacity" />
|
||||
<Intrinsic Name="len" Expression="is_inline() ? capacity : data.variant1.value.len" />
|
||||
<Intrinsic Name="data_ptr" Expression="is_inline() ? data.variant0.value.__0.value.value : data.variant1.value.ptr.pointer" />
|
||||
|
||||
<DisplayString>{{ len={len()} is_inline={is_inline()} }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[capacity]">is_inline() ? $T2 : capacity</Item>
|
||||
<Item Name="[len]">len()</Item>
|
||||
<Item Name="[data_ptr]">data_ptr()</Item>
|
||||
|
||||
<ArrayItems>
|
||||
<Size>len()</Size>
|
||||
<ValuePointer>data_ptr()</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
<Type Name="smallvec::SmallVec<array$<*,*>>" Priority="MediumLow">
|
||||
<Intrinsic Name="is_inline" Expression="$T2 >= capacity" />
|
||||
<Intrinsic Name="len" Expression="is_inline() ? capacity : data.heap.__1" />
|
||||
<Intrinsic Name="data_ptr" Expression="is_inline() ? data.inline.value.value.value : data.heap.__0.pointer" />
|
||||
<DisplayString>{{ len={len()} is_inline={is_inline()} }}</DisplayString>
|
||||
<Expand>
|
||||
<Item Name="[capacity]">is_inline() ? $T2 : capacity</Item>
|
||||
<Item Name="[len]">len()</Item>
|
||||
|
||||
<ArrayItems>
|
||||
<Size>len()</Size>
|
||||
<ValuePointer>data_ptr()</ValuePointer>
|
||||
</ArrayItems>
|
||||
</Expand>
|
||||
</Type>
|
||||
</AutoVisualizer>
|
24
vendor/smallvec/scripts/run_miri.sh
vendored
Normal file
24
vendor/smallvec/scripts/run_miri.sh
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
#!/usr/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
# Clean out our target dir, which may have artifacts compiled by a version of
|
||||
# rust different from the one we're about to download.
|
||||
cargo clean
|
||||
|
||||
# Install and run the latest version of nightly where miri built successfully.
|
||||
# Taken from: https://github.com/rust-lang/miri#running-miri-on-ci
|
||||
|
||||
MIRI_NIGHTLY=nightly-$(curl -s https://rust-lang.github.io/rustup-components-history/x86_64-unknown-linux-gnu/miri)
|
||||
echo "Installing latest nightly with Miri: $MIRI_NIGHTLY"
|
||||
rustup override unset
|
||||
rustup default "$MIRI_NIGHTLY"
|
||||
|
||||
rustup component add miri
|
||||
cargo miri setup
|
||||
|
||||
cargo miri test --verbose
|
||||
cargo miri test --verbose --features union
|
||||
cargo miri test --verbose --all-features
|
||||
|
||||
rustup override set nightly
|
19
vendor/smallvec/src/arbitrary.rs
vendored
Normal file
19
vendor/smallvec/src/arbitrary.rs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
use crate::{Array, SmallVec};
|
||||
use arbitrary::{Arbitrary, Unstructured};
|
||||
|
||||
impl<'a, A: Array> Arbitrary<'a> for SmallVec<A>
|
||||
where
|
||||
<A as Array>::Item: Arbitrary<'a>,
|
||||
{
|
||||
fn arbitrary(u: &mut Unstructured<'a>) -> arbitrary::Result<Self> {
|
||||
u.arbitrary_iter()?.collect()
|
||||
}
|
||||
|
||||
fn arbitrary_take_rest(u: Unstructured<'a>) -> arbitrary::Result<Self> {
|
||||
u.arbitrary_take_rest_iter()?.collect()
|
||||
}
|
||||
|
||||
fn size_hint(depth: usize) -> (usize, Option<usize>) {
|
||||
arbitrary::size_hint::and(<usize as Arbitrary>::size_hint(depth), (0, None))
|
||||
}
|
||||
}
|
2457
vendor/smallvec/src/lib.rs
vendored
Normal file
2457
vendor/smallvec/src/lib.rs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
19
vendor/smallvec/src/specialization.rs
vendored
Normal file
19
vendor/smallvec/src/specialization.rs
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
//! Implementations that require `default fn`.
|
||||
|
||||
use super::{Array, SmallVec, SpecFrom};
|
||||
|
||||
impl<'a, A: Array> SpecFrom<A, &'a [A::Item]> for SmallVec<A>
|
||||
where
|
||||
A::Item: Clone,
|
||||
{
|
||||
#[inline]
|
||||
default fn spec_from(slice: &'a [A::Item]) -> SmallVec<A> {
|
||||
slice.into_iter().cloned().collect()
|
||||
}
|
||||
}
|
1013
vendor/smallvec/src/tests.rs
vendored
Normal file
1013
vendor/smallvec/src/tests.rs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
68
vendor/smallvec/tests/debugger_visualizer.rs
vendored
Normal file
68
vendor/smallvec/tests/debugger_visualizer.rs
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
use debugger_test::debugger_test;
|
||||
use smallvec::{smallvec, SmallVec};
|
||||
|
||||
#[inline(never)]
|
||||
fn __break() {}
|
||||
|
||||
#[debugger_test(
|
||||
debugger = "cdb",
|
||||
commands = r#"
|
||||
.nvlist
|
||||
dx sv
|
||||
|
||||
g
|
||||
|
||||
dx sv
|
||||
|
||||
g
|
||||
|
||||
dx sv
|
||||
"#,
|
||||
expected_statements = r#"
|
||||
sv : { len=0x2 is_inline=true } [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[capacity] : 4
|
||||
[len] : 0x2 [Type: unsigned __int64]
|
||||
[0] : 1 [Type: int]
|
||||
[1] : 2 [Type: int]
|
||||
|
||||
sv : { len=0x5 is_inline=false } [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[capacity] : 0x8 [Type: unsigned __int64]
|
||||
[len] : 0x5 [Type: unsigned __int64]
|
||||
[0] : 5 [Type: int]
|
||||
[1] : 2 [Type: int]
|
||||
[2] : 3 [Type: int]
|
||||
[3] : 4 [Type: int]
|
||||
[4] : 5 [Type: int]
|
||||
|
||||
sv : { len=0x5 is_inline=false } [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[<Raw View>] [Type: smallvec::SmallVec<array$<i32,4> >]
|
||||
[capacity] : 0x8 [Type: unsigned __int64]
|
||||
[len] : 0x5 [Type: unsigned __int64]
|
||||
[0] : 2 [Type: int]
|
||||
[1] : 3 [Type: int]
|
||||
[2] : 4 [Type: int]
|
||||
[3] : 5 [Type: int]
|
||||
[4] : 5 [Type: int]
|
||||
"#
|
||||
)]
|
||||
#[inline(never)]
|
||||
fn test_debugger_visualizer() {
|
||||
// This SmallVec can hold up to 4 items on the stack:
|
||||
let mut sv: SmallVec<[i32; 4]> = smallvec![1, 2];
|
||||
__break();
|
||||
|
||||
// Overfill the SmallVec to move its contents to the heap
|
||||
for i in 3..6 {
|
||||
sv.push(i);
|
||||
}
|
||||
|
||||
// Update the contents of the first value of the SmallVec.
|
||||
sv[0] = sv[1] + sv[2];
|
||||
__break();
|
||||
|
||||
// Sort the SmallVec in place.
|
||||
sv.sort();
|
||||
__break();
|
||||
}
|
24
vendor/smallvec/tests/macro.rs
vendored
Normal file
24
vendor/smallvec/tests/macro.rs
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
/// This file tests `smallvec!` without actually having the macro in scope.
|
||||
/// This forces any recursion to use a `$crate` prefix to reliably find itself.
|
||||
|
||||
#[test]
|
||||
fn smallvec() {
|
||||
let mut vec: smallvec::SmallVec<[i32; 2]>;
|
||||
|
||||
macro_rules! check {
|
||||
($init:tt) => {
|
||||
vec = smallvec::smallvec! $init;
|
||||
assert_eq!(*vec, *vec! $init);
|
||||
}
|
||||
}
|
||||
|
||||
check!([0; 0]);
|
||||
check!([1; 1]);
|
||||
check!([2; 2]);
|
||||
check!([3; 3]);
|
||||
|
||||
check!([]);
|
||||
check!([1]);
|
||||
check!([1, 2]);
|
||||
check!([1, 2, 3]);
|
||||
}
|
Reference in New Issue
Block a user