Sign In

bitvec

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitvec - cargo Package Compare versions

Comparing version
1.0.0-rc1
to
1.0.0-rc2
+5
.cargo_vcs_info.json
{
"git": {
"sha1": "a7a82c67206d6e3ced67294883f6d1baaae7d74c"
}
}
+550
-1

@@ -6,2 +6,19 @@ # This file is automatically @generated by Cargo.

[[package]]
name = "atty"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
dependencies = [
"hermit-abi",
"libc",
"winapi",
]
[[package]]
name = "autocfg"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
[[package]]
name = "bincode"

@@ -16,6 +33,13 @@ version = "1.3.3"

[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "bitvec"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
dependencies = [
"bincode",
"criterion",
"funty",

@@ -33,2 +57,29 @@ "radium",

[[package]]
name = "bstr"
version = "0.2.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
dependencies = [
"lazy_static",
"memchr",
"regex-automata",
"serde",
]
[[package]]
name = "bumpalo"
version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
[[package]]
name = "cast"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c24dab4283a142afa2fdca129b80ad2c6284e073930f964c3a1293c225ee39a"
dependencies = [
"rustc_version",
]
[[package]]
name = "cfg-if"

@@ -40,2 +91,121 @@ version = "1.0.0"

[[package]]
name = "clap"
version = "2.34.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c"
dependencies = [
"bitflags",
"textwrap",
"unicode-width",
]
[[package]]
name = "criterion"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1604dafd25fba2fe2d5895a9da139f8dc9b319a5fe5354ca137cbbce4e178d10"
dependencies = [
"atty",
"cast",
"clap",
"criterion-plot",
"csv",
"itertools",
"lazy_static",
"num-traits",
"oorandom",
"plotters",
"rayon",
"regex",
"serde",
"serde_cbor",
"serde_derive",
"serde_json",
"tinytemplate",
"walkdir",
]
[[package]]
name = "criterion-plot"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d00996de9f2f7559f7f4dc286073197f83e92256a59ed395f9aac01fe717da57"
dependencies = [
"cast",
"itertools",
]
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
dependencies = [
"cfg-if",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-deque"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e"
dependencies = [
"cfg-if",
"crossbeam-epoch",
"crossbeam-utils",
]
[[package]]
name = "crossbeam-epoch"
version = "0.9.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
dependencies = [
"cfg-if",
"crossbeam-utils",
"lazy_static",
"memoffset",
"scopeguard",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
dependencies = [
"cfg-if",
"lazy_static",
]
[[package]]
name = "csv"
version = "1.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22813a6dc45b335f9bade10bf7271dc477e81113e89eb251a0bc2a8a81c536e1"
dependencies = [
"bstr",
"csv-core",
"itoa",
"ryu",
"serde",
]
[[package]]
name = "csv-core"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b2466559f260f48ad25fe6317b3c8dac77b5bdb5763ac7d9d6103530663bc90"
dependencies = [
"memchr",
]
[[package]]
name = "either"
version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "funty"

@@ -58,2 +228,26 @@ version = "2.0.0"

[[package]]
name = "half"
version = "1.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7"
[[package]]
name = "hermit-abi"
version = "0.1.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
dependencies = [
"libc",
]
[[package]]
name = "itertools"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
dependencies = [
"either",
]
[[package]]
name = "itoa"

@@ -65,2 +259,17 @@ version = "0.4.8"

[[package]]
name = "js-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84"
dependencies = [
"wasm-bindgen",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"

@@ -72,2 +281,79 @@ version = "0.2.108"

[[package]]
name = "log"
version = "0.4.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
dependencies = [
"cfg-if",
]
[[package]]
name = "memchr"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "memoffset"
version = "0.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9"
dependencies = [
"autocfg",
]
[[package]]
name = "num-traits"
version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
dependencies = [
"autocfg",
]
[[package]]
name = "num_cpus"
version = "1.13.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
dependencies = [
"hermit-abi",
"libc",
]
[[package]]
name = "oorandom"
version = "11.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
[[package]]
name = "plotters"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a3fd9ec30b9749ce28cd91f255d569591cdf937fe280c312143e3c4bad6f2a"
dependencies = [
"num-traits",
"plotters-backend",
"plotters-svg",
"wasm-bindgen",
"web-sys",
]
[[package]]
name = "plotters-backend"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d88417318da0eaf0fdcdb51a0ee6c3bed624333bff8f946733049380be67ac1c"
[[package]]
name = "plotters-svg"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "521fa9638fa597e1dc53e9412a4f9cefb01187ee1f7413076f9e6749e2885ba9"
dependencies = [
"plotters-backend",
]
[[package]]
name = "ppv-lite86"

@@ -79,2 +365,20 @@ version = "0.2.15"

[[package]]
name = "proc-macro2"
version = "1.0.32"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
dependencies = [
"unicode-xid",
]
[[package]]
name = "quote"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
dependencies = [
"proc-macro2",
]
[[package]]
name = "radium"

@@ -126,2 +430,57 @@ version = "0.7.0"

[[package]]
name = "rayon"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
dependencies = [
"autocfg",
"crossbeam-deque",
"either",
"rayon-core",
]
[[package]]
name = "rayon-core"
version = "1.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
"lazy_static",
"num_cpus",
]
[[package]]
name = "regex"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132"
[[package]]
name = "regex-syntax"
version = "0.6.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
[[package]]
name = "rustc_version"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
dependencies = [
"semver",
]
[[package]]
name = "ryu"

@@ -133,2 +492,23 @@ version = "1.0.5"

[[package]]
name = "same-file"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502"
dependencies = [
"winapi-util",
]
[[package]]
name = "scopeguard"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
[[package]]
name = "serde"

@@ -140,2 +520,23 @@ version = "1.0.130"

[[package]]
name = "serde_cbor"
version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
dependencies = [
"half",
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.130"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serde_json"

@@ -167,2 +568,13 @@ version = "1.0.72"

[[package]]
name = "syn"
version = "1.0.82"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
dependencies = [
"proc-macro2",
"quote",
"unicode-xid",
]
[[package]]
name = "tap"

@@ -174,2 +586,44 @@ version = "1.0.1"

[[package]]
name = "textwrap"
version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
dependencies = [
"unicode-width",
]
[[package]]
name = "tinytemplate"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
dependencies = [
"serde",
"serde_json",
]
[[package]]
name = "unicode-width"
version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973"
[[package]]
name = "unicode-xid"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
[[package]]
name = "walkdir"
version = "2.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56"
dependencies = [
"same-file",
"winapi",
"winapi-util",
]
[[package]]
name = "wasi"

@@ -181,2 +635,97 @@ version = "0.10.2+wasi-snapshot-preview1"

[[package]]
name = "wasm-bindgen"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce"
dependencies = [
"cfg-if",
"wasm-bindgen-macro",
]
[[package]]
name = "wasm-bindgen-backend"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b"
dependencies = [
"bumpalo",
"lazy_static",
"log",
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9"
dependencies = [
"quote",
"wasm-bindgen-macro-support",
]
[[package]]
name = "wasm-bindgen-macro-support"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab"
dependencies = [
"proc-macro2",
"quote",
"syn",
"wasm-bindgen-backend",
"wasm-bindgen-shared",
]
[[package]]
name = "wasm-bindgen-shared"
version = "0.2.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc"
[[package]]
name = "web-sys"
version = "0.3.55"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb"
dependencies = [
"js-sys",
"wasm-bindgen",
]
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
dependencies = [
"winapi-i686-pc-windows-gnu",
"winapi-x86_64-pc-windows-gnu",
]
[[package]]
name = "winapi-i686-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
[[package]]
name = "winapi-util"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
dependencies = [
"winapi",
]
[[package]]
name = "winapi-x86_64-pc-windows-gnu"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "wyz"

@@ -183,0 +732,0 @@ version = "0.5.0"

+4
-1

@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "bitvec"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
include = ["Cargo.toml", "LICENSE.txt", "README.md", "doc/**/*.md", "src/**/*.rs", "benches/*.rs"]

@@ -51,2 +51,5 @@ description = "Addresses memory by bits, for packed collections and bitfields"

[dev-dependencies.criterion]
version = "0.3"
[dev-dependencies.rand]

@@ -53,0 +56,0 @@ version = "0.8"

@@ -15,2 +15,24 @@ # Bit-Level Access Instructions

## Implementation and Safety Notes
This trait is automatically implemented for all types that implement `Radium`,
and relies exclusively on `Radium`’s API and implementations for its work. In
particular, `Radium` has no functions which operate on **pointers**: it
exclusively operates on memory through **references**. Since references must
always refer to initialized memory, `BitAccess` and, by extension, all APIs in
`bitvec` that touch memory, cannot be used to operate on uninitialized memory in
any way.
While you may *create* a `bitvec` pointer object that targets uninitialized
memory, you may not *dereference* it until the targeted memory has been wholly
initialized with integer values.
This restriction cannot be loosened without stable access to pointer-based
atomic intrinsics in the Rust standard library and corresponding updates to the
`Radium` trait.
Do not attempt to access uninitialized memory through `bitvec`. Doing so will
cause `bitvec` to produce references to uninitialized memory, which is undefined
behavior.
[`Radium`]: radium::Radium

@@ -17,0 +39,0 @@ [`index`]: crate::index

@@ -20,3 +20,3 @@ # Bit-Field Memory Slots

This is most efficient when using `BitSlice<O, usize>` as the storage bit-slice,
This is most efficient when using `BitSlice<usize, O>` as the storage bit-slice,
or using `.load::<usize>()` or `.store::<usize>()` as the transfer type.

@@ -27,3 +27,3 @@

`BitField` permits any type of integer, *including signed integers*, to be
stored into or loaded out of a `BitSlice<_, T>` with any storage type `T`. While
stored into or loaded out of a `BitSlice<T, _>` with any storage type `T`. While
the examples in this module will largely use `u8`, just to keep the text

@@ -33,6 +33,6 @@ concise, `BitField` is tested, and will work correctly, for any combination of

`Bitfield` implementations use the processor’s own concept of integer registers
`BitField` implementations use the processor’s own concept of integer registers
to operate. As such, the byte-wise memory access patters for types wider than
`u8` depends on your processor’s byte endianness, as well as which `BitField`
method, and which `BitOrder` type parameter, you are using.
method, and which [`BitOrder`] type parameter, you are using.

@@ -63,8 +63,9 @@ `BitField` only operates within processor registers; traffic of `T` elements

bit of the `i12` value and sign-extend it to `i16`. This means that storing
`4096i16` into a 12-bit slice and then loading it back out into an `i16` will
produce `-4096i16`, not `+4096i16`, because `1 << 12` is the sign bit.
`2048i16` into a 12-bit slice and then loading it back out into an `i16` will
produce `-2048i16` (negative), not `2048i16` (positive), because `1 << 11` is
the sign bit.
`BitField` **does not** record the true sign bit of an integer being stored, and
will not attempt to set the sign bit of the narrowed value in storage. Storing
`-127i8` into a 7-bit slice will load `1i8`.
`-127i8` (`0b1000_0001`) into a 7-bit slice will load `1i8`.

@@ -134,3 +135,4 @@ ## Register Bit Order Preservation

[`BitField`]: self::BitField
[`BitOrder`]: crate::order::BitOrder
[`BitSlice`]: crate::slice::BitSlice
[`Domain::Region`]: crate::domain::Domain::Region

@@ -36,5 +36,5 @@ # Single-Bit Pointer

memory. Only `Mut` pointers can be used to create `&mut` references.
- `O`: The ordering of bits within a memory element.
- `T`: A memory type used to select both the register width and the bus behavior
when performing memory accesses.
- `O`: The ordering of bits within a memory element.

@@ -49,1 +49,15 @@ ## Usage

These pointers can never be null or misaligned.
## Safety
Rust and LLVM **do not** have a concept of bit-level initialization yet.
Furthermore, the underlying foundational code that this type uses to manipulate
individual bits in memory relies on construction of **shared references** to
memory, which means that unlike standard pointers, the `T` element to which
`BitPtr` values point must always be **already initialized** in your program
context.
`bitvec` is not able to detect or enforce this requirement, and is currently not
able to avoid it. See [`BitAccess`] for more information.
[`BitAccess`]: crate::access::BitAccess

@@ -149,3 +149,19 @@ # Bit-Precision Dynamic Array

## Safety
Unlike the other data structures in this crate, `BitVec` is uniquely able to
hold uninitialized memory and produce pointers into it. As described in the
[`BitAccess`] documentation, this crate is categorically unable to operate on
uninitialized memory in any way. In particular, you may not allocate a buffer
using [`::with_capacity()`], then use [`.as_mut_bitptr()`] to create a pointer
used to write into the uninitialized buffer.
You must always initialize the buffer contents of a `BitVec` before attempting
to view its contents. You can accomplish this through safe APIs such as
`.push()`, `.extend()`, or `.reserve()`. These are all guaranteed to safely
initialize the memory elements underlying the `BitVec` buffer without incurring
undefined behavior in their operation.
[book]: https://bitvecto-rs.github.io/bitvec/type-parameters.html
[`BitAccess`]: crate::access::BitAccess
[`BitArray`]: crate::array::BitArray

@@ -156,3 +172,5 @@ [`BitField`]: crate::field::BitField

[`std::vector<bool>`]: https://en.cppreference.com/w/cpp/container/vector_bool
[`.as_mut_bitptr()`]: crate::slice::BitSlice::as_mut_bitptr
[`.get_mut()`]: crate::slice::BitSlice::get_mut
[`.set()`]: crate::slice::BitSlice::set
[`::with_capacity()`]: Self::with_capacity

@@ -213,3 +213,3 @@ #![doc = include_str!("../../doc/boxed/iter.md")]

/// [Original](https://doc.rust-lang.org/alloc/vec/struct.IntoIter.html#impl-Send)
#[allow(clippy::non_send_fields_in_send_ty)]
// #[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl<T, O> Send for IntoIter<T, O>

@@ -216,0 +216,0 @@ where

@@ -141,2 +141,3 @@ //! Invocation tests of each supported constructor-macro syntax.

#[test]
#[allow(clippy::many_single_char_names)]
fn compile_bits() {

@@ -143,0 +144,0 @@ let a: &mut BitSlice<Cell<u8>, Lsb0> = bits![mut Cell<u8>, Lsb0; 1, 0, 1];

@@ -379,3 +379,3 @@ #![doc = include_str!("../../doc/ptr/proxy.md")]

#[allow(clippy::non_send_fields_in_send_ty)] // I know what I’m doing
// #[allow(clippy::non_send_fields_in_send_ty)] // I know what I’m doing
unsafe impl<M, T, O> Send for BitRef<'_, M, T, O>

@@ -382,0 +382,0 @@ where

@@ -205,4 +205,6 @@ #![doc = include_str!("../../doc/ptr/span.md")]

) -> Self {
let addr = addr.to_const().cast::<u8>();
let head = head.into_inner() as usize;
let ptr_data = addr.to_const() as usize & Self::PTR_ADDR_MASK;
let ptr_data = addr as usize & Self::PTR_ADDR_MASK;
let ptr_head = head >> Self::LEN_HEAD_BITS;

@@ -213,4 +215,15 @@

/* See <https://github.com/bitvecto-rs/bitvec/issues/135#issuecomment-986357842>.
* This attempts to retain inbound provenance information and may help
* Miri better understand pointer operations this module performs.
*
* This performs `a + (p - a)` in `addr`’s provenance zone, which is
* numerically equivalent to `p` but does not require conjuring a new,
* uninformed, pointer value.
*/
let ptr_raw = ptr_data | ptr_head;
let ptr = addr.wrapping_add(ptr_raw.wrapping_sub(addr as usize));
Self {
ptr: NonNull::new_unchecked((ptr_data | ptr_head) as *mut ()),
ptr: NonNull::new_unchecked(ptr.cast::<()>() as *mut ()),
len: len_bits | len_head,

@@ -261,3 +274,3 @@ ..Self::EMPTY

/// [`::new`]: Self::new
#[cfg(any(feature = "alloc", test))]
#[cfg(feature = "alloc")]
pub(crate) unsafe fn set_address(&mut self, addr: Address<M, T>) {

@@ -301,3 +314,3 @@ let mut addr_value = addr.to_const() as usize;

/// `.addr` or `.bits`.
#[cfg(any(feature = "alloc", test))]
#[cfg(feature = "alloc")]
pub(crate) unsafe fn set_head(&mut self, head: BitIdx<T::Mem>) {

@@ -304,0 +317,0 @@ let head = head.into_inner() as usize;

@@ -860,8 +860,2 @@ #![doc = include_str!("../doc/slice.md")]

let right = right.span_unchecked(len - mid);
/* This is load-bearing. If it is removed, Miri crashes tests as UAF.
* It must also be `.wrapping_sub()`, not `.sub()`, or Miri crashes as
* OOB. The reasons why are not clear, since it is exactly inverting
* the `left.add(mid)` done above.
*/
debug_assert_eq!(right.to_bitptr().wrapping_sub(mid), left.to_bitptr());
let left = left.into_bitslice_ref();

@@ -944,10 +938,9 @@ let right = right.into_bitslice_ref();

let dest = dest .. dest + source_len;
for (bit, to) in self
for (from, to) in self
.get_unchecked(source)
.iter()
.by_vals()
.as_bitptr_range()
.zip(self.get_unchecked_mut(dest).as_mut_bitptr_range())
.bidi(rev)
{
to.write(bit);
to.write(from.read());
}

@@ -954,0 +947,0 @@ }

@@ -10,6 +10,3 @@ #![doc = include_str!("../../doc/slice/iter.md")]

},
iter::{
FusedIterator,
Map,
},
iter::FusedIterator,
marker::PhantomData,

@@ -35,3 +32,2 @@ mem,

ptr::{
BitPtr,
BitPtrRange,

@@ -43,9 +39,2 @@ BitRef,

/// An iterator over `BitSlice` that yields `&bool` references.
pub type ByRefs<'a, T, O> = Map<ByVal<T, O>, fn(bool) -> &'a bool>;
/// An iterator over `BitSlice` that yields `bool` values.
pub type ByVal<T, O> =
Map<BitPtrRange<Const, T, O>, fn(BitPtr<Const, T, O>) -> bool>;
/// [Original](https://doc.rust-lang.org/core/iter/trait.IntoIterator.html#impl-IntoIterator-1)

@@ -166,3 +155,9 @@ #[cfg(not(tarpaulin_include))]

/// [0]: crate::ptr::BitRef
pub fn by_refs(self) -> ByRefs<'a, T, O> {
pub fn by_refs(
self,
) -> impl 'a
+ Iterator<Item = &'a bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
self.by_vals().map(|bit| match bit {

@@ -207,3 +202,9 @@ true => &true,

/// [0]: crate::ptr::BitRef
pub fn by_vals(self) -> ByVal<T, O> {
pub fn by_vals(
self,
) -> impl 'a
+ Iterator<Item = bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
self.range.map(|bp| unsafe { bp.read() })

@@ -227,3 +228,9 @@ }

`.by_vals()` instead"]
pub fn copied(self) -> ByVal<T, O> {
pub fn copied(
self,
) -> impl 'a
+ Iterator<Item = bool>
+ DoubleEndedIterator
+ ExactSizeIterator
+ FusedIterator {
self.by_vals()

@@ -468,3 +475,3 @@ }

/// [Original](https://doc.rust-lang.org/core/slice/struct.IterMut.html#impl-Send)
#[allow(clippy::non_send_fields_in_send_ty)]
// #[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl<'a, T, O> Send for $iter<'a, T, O>

@@ -471,0 +478,0 @@ where

@@ -330,2 +330,32 @@ #![doc = include_str!("../doc/vec.md")]

/// Creates an unsafe shared bit-pointer to the start of the buffer.
///
/// ## Original
///
/// [`Vec::as_ptr`](alloc::vec::Vec::as_ptr)
///
/// ## Safety
///
/// You must initialize the contents of the underlying buffer before
/// accessing memory through this pointer. See the `BitPtr` documentation
/// for more details.
pub fn as_bitptr(&self) -> BitPtr<Const, T, O> {
self.bitspan.to_bitptr().to_const()
}
/// Creates an unsafe writable bit-pointer to the start of the buffer.
///
/// ## Original
///
/// [`Vec::as_mut_ptr`](alloc::vec::Vec::as_mut_ptr)
///
/// ## Safety
///
/// You must initialize the contents of the underlying buffer before
/// accessing memory through this pointer. See the `BitPtr` documentation
/// for more details.
pub fn as_mut_bitptr(&mut self) -> BitPtr<Mut, T, O> {
self.bitspan.to_bitptr()
}
/// Converts a bit-vector into a boxed bit-slice.

@@ -332,0 +362,0 @@ ///

@@ -974,4 +974,7 @@ //! Port of the `Vec<bool>` inherent API.

/// // a b c
/// let mut yank = bv.splice(.. 2, bits![1, 1, 0].iter().by_vals());
/// // d e f
/// let mut yank = bv.splice(
/// .. 2,
/// bits![static 1, 1, 0].iter().by_vals(),
/// // d e f
/// );
///

@@ -978,0 +981,0 @@ /// assert!(!yank.next().unwrap()); // a

@@ -473,3 +473,3 @@ #![doc = include_str!("../../doc/vec/iter.md")]

/// [Original](https://doc.rust-lang.org/alloc/vec/struct.Drain.html#impl-Send)
#[allow(clippy::non_send_fields_in_send_ty)]
// #[allow(clippy::non_send_fields_in_send_ty)]
unsafe impl<T, O> Send for Drain<'_, T, O>

@@ -476,0 +476,0 @@ where

Sorry, the diff of this file is not supported yet