summaryrefslogtreecommitdiffstats
path: root/vendor/smallvec
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/smallvec')
-rw-r--r--vendor/smallvec/.cargo-checksum.json2
-rw-r--r--vendor/smallvec/Cargo.toml31
-rw-r--r--vendor/smallvec/debug_metadata/README.md111
-rw-r--r--vendor/smallvec/debug_metadata/smallvec.natvis35
-rw-r--r--vendor/smallvec/scripts/run_miri.sh3
-rw-r--r--vendor/smallvec/src/lib.rs7
-rw-r--r--vendor/smallvec/tests/debugger_visualizer.rs68
7 files changed, 253 insertions, 4 deletions
diff --git a/vendor/smallvec/.cargo-checksum.json b/vendor/smallvec/.cargo-checksum.json
index 8f4d7bf91..e9fa9e1e6 100644
--- a/vendor/smallvec/.cargo-checksum.json
+++ b/vendor/smallvec/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.toml":"03ae7e6a133c5fd1685687aee67bc841642a4fd0deeb0d4d88b9fe27af37ba9e","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b28172679e0009b655da42797c03fd163a3379d5cfa67ba1f1655e974a2a1a9","README.md":"a01127c37308457e8d396b176fb790846be0978c173be3f13260b62efcef011b","benches/bench.rs":"e2a235d68be20996014c00468b369887d2041ce95486625de3cef35b8f2e4acd","scripts/run_miri.sh":"0d0b8c54c73fa9da1217d29ed0984f8328dd9fb61bb5a02db44458c360cdc3c4","src/arbitrary.rs":"22e55cfbf60374945b30e6d0855129eff67cd8b878cef6fa997e1f4be67b9e3d","src/lib.rs":"264a6e6863aeb21cd779588c2add8421ea1a5861a9bb8ef49e9dc529be8d3b20","src/specialization.rs":"46433586203399251cba496d67b88d34e1be3c2b591986b77463513da1c66471","src/tests.rs":"2bcf69dc0597e4e8a59a92566a3dd5c82ec3a1ea563aa006ea0f4a2722cb2d17","tests/macro.rs":"22ad4f6f104a599fdcba19cad8834105b8656b212fb6c7573a427d447f5db14f"},"package":"2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1"} \ No newline at end of file
+{"files":{"Cargo.toml":"e8b7e22c87fa34e053c12b3751ec0c7b25b37bd1285959710321a7a00861f392","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0b28172679e0009b655da42797c03fd163a3379d5cfa67ba1f1655e974a2a1a9","README.md":"a01127c37308457e8d396b176fb790846be0978c173be3f13260b62efcef011b","benches/bench.rs":"e2a235d68be20996014c00468b369887d2041ce95486625de3cef35b8f2e4acd","debug_metadata/README.md":"dc8fbf896055359a94f7bfdfae7604e0bcfc8b10998a218d484d9fffdf83637c","debug_metadata/smallvec.natvis":"68aed2322bdc13ed6fa2021dc9625346174d73590929acbc2f95c98785c8dee4","scripts/run_miri.sh":"74a9f9adc43f986e81977b03846f7dd00122a0150bd8ec3fe4842a1a787e0f07","src/arbitrary.rs":"22e55cfbf60374945b30e6d0855129eff67cd8b878cef6fa997e1f4be67b9e3d","src/lib.rs":"35c60a9d9240853e9f6f84b7a44ff6a3197a87ab404f5ab1cd8ebeeeb72e54da","src/specialization.rs":"46433586203399251cba496d67b88d34e1be3c2b591986b77463513da1c66471","src/tests.rs":"2bcf69dc0597e4e8a59a92566a3dd5c82ec3a1ea563aa006ea0f4a2722cb2d17","tests/debugger_visualizer.rs":"87480900add8579e1285741d5a0041063b6d888328e11854ab2cdc2960d7ddb1","tests/macro.rs":"22ad4f6f104a599fdcba19cad8834105b8656b212fb6c7573a427d447f5db14f"},"package":"a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"} \ No newline at end of file
diff --git a/vendor/smallvec/Cargo.toml b/vendor/smallvec/Cargo.toml
index fd490da15..a365ca18e 100644
--- a/vendor/smallvec/Cargo.toml
+++ b/vendor/smallvec/Cargo.toml
@@ -12,18 +12,35 @@
[package]
edition = "2018"
name = "smallvec"
-version = "1.9.0"
+version = "1.10.0"
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"]
+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"]
+rustdoc-args = [
+ "--cfg",
+ "docsrs",
+]
+
+[[test]]
+name = "debugger_visualizer"
+path = "tests/debugger_visualizer.rs"
+test = false
+required-features = ["debugger_visualizer"]
+
[dependencies.arbitrary]
version = "1"
optional = true
@@ -32,12 +49,20 @@ optional = true
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 = []
may_dangle = []
specialization = []
union = []
diff --git a/vendor/smallvec/debug_metadata/README.md b/vendor/smallvec/debug_metadata/README.md
new file mode 100644
index 000000000..137500813
--- /dev/null
+++ b/vendor/smallvec/debug_metadata/README.md
@@ -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, descibe 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
+```
diff --git a/vendor/smallvec/debug_metadata/smallvec.natvis b/vendor/smallvec/debug_metadata/smallvec.natvis
new file mode 100644
index 000000000..b38d47cb7
--- /dev/null
+++ b/vendor/smallvec/debug_metadata/smallvec.natvis
@@ -0,0 +1,35 @@
+<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
+ <Type Name="smallvec::SmallVec&lt;array$&lt;*,*&gt;&gt;" Priority="Medium">
+ <Intrinsic Name="is_inline" Expression="$T2 &gt; capacity" />
+ <Intrinsic Name="len" Expression="is_inline() ? capacity : data.variant1.value.__0.__1" />
+ <Intrinsic Name="data_ptr" Expression="is_inline() ? data.variant0.value.__0.value.value : data.variant1.value.__0.__0" />
+
+ <DisplayString>{{ len={len()} }}</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>
+
+ <Type Name="smallvec::SmallVec&lt;array$&lt;*,*&gt;&gt;" Priority="MediumLow">
+ <Intrinsic Name="is_inline" Expression="$T2 &gt; 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" />
+
+ <DisplayString>{{ len={len()} }}</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> \ No newline at end of file
diff --git a/vendor/smallvec/scripts/run_miri.sh b/vendor/smallvec/scripts/run_miri.sh
index 817928a09..010ceb06e 100644
--- a/vendor/smallvec/scripts/run_miri.sh
+++ b/vendor/smallvec/scripts/run_miri.sh
@@ -11,6 +11,7 @@ cargo clean
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
@@ -19,3 +20,5 @@ cargo miri setup
cargo miri test --verbose
cargo miri test --verbose --features union
cargo miri test --verbose --all-features
+
+rustup override set nightly
diff --git a/vendor/smallvec/src/lib.rs b/vendor/smallvec/src/lib.rs
index 921347af8..a335ca46c 100644
--- a/vendor/smallvec/src/lib.rs
+++ b/vendor/smallvec/src/lib.rs
@@ -81,6 +81,11 @@
#![cfg_attr(feature = "specialization", allow(incomplete_features))]
#![cfg_attr(feature = "specialization", feature(specialization))]
#![cfg_attr(feature = "may_dangle", feature(dropck_eyepatch))]
+#![cfg_attr(
+ feature = "debugger_visualizer",
+ feature(debugger_visualizer),
+ debugger_visualizer(natvis_file = "../debug_metadata/smallvec.natvis")
+)]
#![deny(missing_docs)]
#[doc(hidden)]
@@ -2084,6 +2089,7 @@ impl<T, const N: usize> SmallVec<[T; N]> {
#[cfg_attr(docsrs, doc(cfg(feature = "const_generics")))]
unsafe impl<T, const N: usize> Array for [T; N] {
type Item = T;
+ #[inline]
fn size() -> usize {
N
}
@@ -2095,6 +2101,7 @@ macro_rules! impl_array(
$(
unsafe impl<T> Array for [T; $size] {
type Item = T;
+ #[inline]
fn size() -> usize { $size }
}
)+
diff --git a/vendor/smallvec/tests/debugger_visualizer.rs b/vendor/smallvec/tests/debugger_visualizer.rs
new file mode 100644
index 000000000..210f539b6
--- /dev/null
+++ b/vendor/smallvec/tests/debugger_visualizer.rs
@@ -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 } [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 } [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 } [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();
+}