Skip to content

Commit f821122

Browse files
committed
Rewrite the project for 0.18 development
This commit was made by destroying and rebuilding the `src/` tree, and contains too many changes to document here. Notable changes are listed in the changelog.
1 parent e1cc5cf commit f821122

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+13967
-14143
lines changed

CHANGELOG.md

Lines changed: 115 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ All notable changes will be documented in this file.
55
This document is written according to the [Keep a Changelog][kac] style.
66

77
1. [0.18.0](#0180)
8+
1. [Bit Arrays in Value Position](#bit-arrays-in-value-position)
89
1. [Type-Level Alias Detection](#type-level-alias-detection)
10+
1. [0.17.4](#0174)
911
1. [0.17.3](#0173)
1012
1. [0.17.2](#0172)
1113
1. [0.17.1](#0171)
@@ -38,22 +40,60 @@ This document is written according to the [Keep a Changelog][kac] style.
3840

3941
## 0.18.0
4042

43+
This release was implemented as a total discard and rewrite of the crate. The
44+
rewrite is *largely* a copy of what was discarded, but the crate has been
45+
rebuilt from nothing in order to provide more confidence that all parts of it
46+
were reached. As such, this release has a *lot* of changes.
47+
48+
This release raises the MSRV to `1.44.0`, as [Rust PR #69373] stabilizes the
49+
integer constructors `from_{b,l,n}e_bytes` and removes the need to reïmplement
50+
them internally.
51+
4152
### Added <!-- omit in toc -->
4253

43-
The CI test harness now covers targets beyond `x86_64-unknown-linux-gnu`, thanks
44-
to GitHub user [@Alexhuszagh]. `bitvec` guarantees support for all targets
45-
listed in the CI matrix through at least the next major relase. If your target
46-
is not in this list, please file an issue for inclusion.
54+
- The CI test harness now covers targets beyond `x86_64-unknown-linux-gnu`,
55+
thanks to GitHub user [@Alexhuszagh]. `bitvec` guarantees support for all
56+
targets listed in the CI matrix through at least the next major relase. If
57+
your target is not in this list, please file an issue for inclusion.
58+
59+
- `BitStore` is implemented on the `AtomicUN` corresponding to each `uN` that
60+
implements `BitStore`, as well as on `Cell<uN>`.
61+
62+
#### Bit Arrays in Value Position
63+
64+
The `BitArray<O, V>` type begins support for emulating the C++ `std::bitset<N>`
65+
type, parameterized over the length in bits. This has been requested in the
66+
past, such as in GitHub [issue #32], and is still (as of writing) not able to be
67+
*correctly* implemented. Instead, `BitArray` is parameterized by a scalar or
68+
array type that is large enough to hold the number of bits that the user wants.
69+
70+
The `bitarr!` macro constructs either values of `BitArray<O, V>` with the same
71+
syntax as the other three macros, or constructs `BitArary<O, V>` typenames
72+
suitable for a number of bits in a given order/store array. Invoked as
73+
`bitarr!(for BITS, in ORDER, STORE)`, it produces a typename that can be used to
74+
correctly type locations that cannot use inference from a value assigned into
75+
them, such as `struct` fields, `static` bindings, and `const` values.
76+
77+
Until type-level integers stabilize, this is the closest solution to the
78+
`std::bitset<N>` behavior that `bitvec` can provide.
4779

4880
### Changed <!-- omit in toc -->
4981

50-
The implementation of the `BitStore` trait is refactored to fully separate the
51-
concepts of memory storage and access. This is not a breaking change to the user
52-
API, as `BitStore` is an opaque trait that can only be used in marker position.
82+
- The implementation of the `BitStore` trait is refactored to fully separate the
83+
concepts of memory storage and access. This is not a breaking change to the
84+
user API, as `BitStore` is an opaque trait that can only be used in marker
85+
position.
86+
87+
- The concrete effect of the `BitStore` internal refactor is that the default
88+
case of memory access is no longer atomic. Slices that have not called
89+
`.split_at_mut` are now guaranteed to elide bus locks to memory when they
90+
write.
5391

54-
The concrete effect of the `BitStore` internal refactor is that the default case
55-
of memory access is no longer atomic. Slices that have not called
56-
`.split_at_mut` are now guaranteed to elide bus locks to memory when they write.
92+
- The `AsBits` trait has been relocated to the `view` module, and split into two
93+
trait families. The `BitView` trait has methods `.view_bits<O>` and
94+
`.view_bits_mut<O>`; the `AsBits<T>` and `AsBitsMut<T>` traits have
95+
`.as_bits<O>` and `.as_bits_mut<O>`, and are intended to correspond to the
96+
`AsRef<T>` and `AsMut<T>` traits in the standard library.
5797

5898
#### Type-Level Alias Detection
5999

@@ -92,6 +132,31 @@ unaliased components.
92132
`.as_slice()`/`.as_mut_slice()` if you require direct access to backing
93133
storage.
94134

135+
## 0.17.4
136+
137+
### Fixed <!-- omit in toc -->
138+
139+
GitHub user [@kulp] noted in [Issue #55] that an allocator error occurred when
140+
attempting to free a large `BitBox` on macOS. The underlying cause was found to
141+
be an improper assembly of a `BitBox` after modifying the underlying allocation.
142+
Specifically, `BitBox` relied on an incorrect assumption that
143+
`Vec::into_boxed_slice` never moved the base address during resizing.
144+
145+
### Yanked Versions <!-- omit in toc -->
146+
147+
**This is a severe memory error!** As such, *all* prior versions of `bitvec`
148+
have been yanked from [crates.io][crate]. Cargo will fetch yanked crates that
149+
are listed in `Cargo.lock`, but will not use them for resolution of the
150+
`Cargo.toml` manifest.
151+
152+
If you feel strongly that you cannot upgrade from a prior minor version, please
153+
file an issue and I will backport this fix and publish a patch on your minor
154+
series. I will also work with you on an upgrade path.
155+
156+
I have made the decision to yank prior versions as this is now the second memory
157+
management error in the `0.17` series, and is demonstrated to exist back to
158+
`0.11`. Versions older than `0.11` are not supported.
159+
95160
## 0.17.3
96161

97162
### Fixed <!-- omit in toc -->
@@ -756,38 +821,43 @@ Initial implementation and release.
756821
- `BitVec` type with basic `Vec` idioms and parallel trait implementations
757822
- `bitvec!` generator macro
758823

759-
[@Alexhuszagh]: //github.com/Alexhuszagh
760-
[@Fotosmile]: //github.com/Fotosmile
761-
[@GeorgeGkas]: //github.com/GeorgeGkas
762-
[@ImmemorConsultrixContrarie]: //github.com/ImmemorConsultrixContrarie
763-
[@caelunshun]: //github.com/caelunshun
764-
[@geq1t]: //github.com/geq1t
765-
[@jonas-schievink]: //github.com/jonas-schievink
766-
[@koushiro]: //github.com/koushiro
767-
[@luojia65]: //github.com/luojia65
768-
[@lynaghk]: //github.com/lynaghk
769-
[@mystor]: //github.com/mystor
770-
[@obeah]: //github.com/obeah
771-
[@overminder]: //github.com/overminder
772-
[@ratorx]: //github.com/ratorx
773-
[@schomatis]: //github.com/schomatis
774-
[@torce]: //github.com/torce
775-
[Issue #7]: //github.com/myrrlyn/bitvec/issues/7
776-
[Issue #8]: //github.com/myrrlyn/bitvec/issues/8
777-
[Issue #9]: //github.com/myrrlyn/bitvec/issues/9
778-
[Issue #10]: //github.com/myrrlyn/bitvec/issues/10
779-
[Issue #12]: //github.com/myrrlyn/bitvec/issues/12
780-
[Issue #15]: //github.com/myrrlyn/bitvec/issues/15
781-
[Issue #16]: //github.com/myrrlyn/bitvec/issues/16
782-
[Issue #17]: //github.com/myrrlyn/bitvec/issues/17
783-
[Issue #28]: //github.com/myrrlyn/bitvec/issues/28
784-
[Issue #33]: //github.com/myrrlyn/bitvec/issues/33
785-
[Issue #35]: //github.com/myrrlyn/bitvec/issues/35
786-
[Issue #36]: //github.com/myrrlyn/bitvec/issues/36
787-
[Issue #40]: //github.com/myrrlyn/bitvec/issues/40
788-
[Issue #43]: //github.com/myrrlyn/bitvec/issues/43
789-
[Issue #50]: //github.com/myrrlyn/bitvec/issues/50
790-
[Pull Request #34]: //github.com/myrrlyn/bitvec/pull/34
791-
[Pull Request #41]: //github.com/myrrlyn/bitvec/pull/41
792-
[`Sync`]: //doc.rust-lang.org/stable/core/marker/trait.Sync.html
793-
[kac]: //keepachangelog.com/en/1.0.0/
824+
[@Alexhuszagh]: https://github.com/Alexhuszagh
825+
[@Fotosmile]: https://github.com/Fotosmile
826+
[@GeorgeGkas]: https://github.com/GeorgeGkas
827+
[@ImmemorConsultrixContrarie]: https://github.com/ImmemorConsultrixContrarie
828+
[@caelunshun]: https://github.com/caelunshun
829+
[@geq1t]: https://github.com/geq1t
830+
[@jonas-schievink]: https://github.com/jonas-schievink
831+
[@koushiro]: https://github.com/koushiro
832+
[@kulp]: https://github.com/kulp
833+
[@luojia65]: https://github.com/luojia65
834+
[@lynaghk]: https://github.com/lynaghk
835+
[@mystor]: https://github.com/mystor
836+
[@obeah]: https://github.com/obeah
837+
[@overminder]: https://github.com/overminder
838+
[@ratorx]: https://github.com/ratorx
839+
[@schomatis]: https://github.com/schomatis
840+
[@torce]: https://github.com/torce
841+
[Issue #7]: https://github.com/myrrlyn/bitvec/issues/7
842+
[Issue #8]: https://github.com/myrrlyn/bitvec/issues/8
843+
[Issue #9]: https://github.com/myrrlyn/bitvec/issues/9
844+
[Issue #10]: https://github.com/myrrlyn/bitvec/issues/10
845+
[Issue #12]: https://github.com/myrrlyn/bitvec/issues/12
846+
[Issue #15]: https://github.com/myrrlyn/bitvec/issues/15
847+
[Issue #16]: https://github.com/myrrlyn/bitvec/issues/16
848+
[Issue #17]: https://github.com/myrrlyn/bitvec/issues/17
849+
[Issue #28]: https://github.com/myrrlyn/bitvec/issues/28
850+
[Issue #32]: https://github.com/myrrlyn/bitvec/issues/32
851+
[Issue #33]: https://github.com/myrrlyn/bitvec/issues/33
852+
[Issue #35]: https://github.com/myrrlyn/bitvec/issues/35
853+
[Issue #36]: https://github.com/myrrlyn/bitvec/issues/36
854+
[Issue #40]: https://github.com/myrrlyn/bitvec/issues/40
855+
[Issue #43]: https://github.com/myrrlyn/bitvec/issues/43
856+
[Issue #50]: https://github.com/myrrlyn/bitvec/issues/50
857+
[Issue #55]: https://github.com/myrrlyn/bitvec/issues/55
858+
[Pull Request #34]: https://github.com/myrrlyn/bitvec/pull/34
859+
[Pull Request #41]: https://github.com/myrrlyn/bitvec/pull/41
860+
[Rust PR #69373]: https://github.com/rust-lang/rust/pull/69373/
861+
[`Sync`]: https://doc.rust-lang.org/stable/core/marker/trait.Sync.html
862+
[crate]: https://crates.io/crates/bitvec
863+
[kac]: https://keepachangelog.com/en/1.0.0/

CODE_OF_CONDUCT.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
This project is subject to the official [Rust code of conduct][coc].
44

55
As there are no dedicated fora for this project, this is only relevant in the
6-
repository or in communication with me about it.
6+
[repository], on the project [Twitter account], or in direct communication with
7+
me, over any medium, about the project.
78

9+
[Twitter account]: https://twitter.com/bitvec_rs
810
[coc]: https://www.rust-lang.org/policies/code-of-conduct
11+
[repository]: https://github.com/myrrlyn/bitvec

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ std = [
4949
[dependencies]
5050
funty = "1"
5151
radium = "0.3"
52+
wyz = "0.2"
5253

5354
[dependencies.serde]
5455
default-features = false
@@ -60,6 +61,7 @@ version = "1"
6061
serde = "1"
6162
serde_json = "1"
6263
serde_test = "1"
64+
static_assertions = "1"
6365

6466
# Indicates the features that docs.rs should enable when building documentation.
6567
[package.metadata.docs.rs]

Justfile

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ build:
1010
cargo build --no-default-features
1111
cargo build --no-default-features --features alloc
1212
cargo build --all-features
13-
cargo build --all-features --example sieve
14-
cargo build --all-features --example tour
13+
@cargo build --all-features --example sieve
14+
@cargo build --all-features --example tour
1515

1616
# Checks the library for syntax and HIR errors.
1717
check:
@@ -30,16 +30,21 @@ ci:
3030
clean:
3131
cargo clean
3232

33+
cover: test
34+
cargo +nightly tarpaulin --all-features -o Html --output-dir target/tarpaulin
35+
@cargo +nightly tarpaulin --all-features -o Xml --output-dir target/tarpaulin &>/dev/null
36+
@tokei
37+
3338
# Runs the development routines.
34-
dev: format lint doc test
39+
dev: format lint doc test cover
3540

3641
# Builds the crate documentation.
3742
doc:
38-
cargo doc --all-features --document-private-items
43+
@cargo doc --all-features --document-private-items
3944

4045
# Runs the formatter on all Rust files.
4146
format:
42-
cargo +nightly fmt -- --config-path rustfmt-nightly.toml
47+
@cargo +nightly fmt -- --config-path rustfmt-nightly.toml
4348

4449
# Runs the linter.
4550
lint: check
@@ -49,7 +54,7 @@ lint: check
4954

5055
# Continually runs some recipe from this file.
5156
loop action:
52-
cargo watch -s "just {{action}}"
57+
watchexec -w src -- "just {{action}}"
5358

5459
miri:
5560
cargo +nightly miri test
@@ -66,6 +71,6 @@ publish: checkout
6671
test: check lint
6772
cargo test --no-default-features
6873
cargo test --all-features
69-
cargo run --all-features --example ipv4
70-
cargo run --all-features --example sieve
71-
cargo run --all-features --example tour
74+
@cargo run --all-features --example ipv4
75+
@cargo run --all-features --example sieve
76+
@cargo run --all-features --example tour

0 commit comments

Comments
 (0)