Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions crates/iddqd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,13 @@ This crate is validated through a combination of:

* Unit tests
* Property-based tests using a naive map as an oracle
* Chaos tests for several kinds of buggy `Eq` and `Ord` implementations
* Explicit tests for panic safety in some scenarios
* Miri tests for unsafe code
* Unit and property-based tests for several kinds of pathological `Eq`,
`Hash` and `Ord` implementations
* Property-based tests for panic safety
* Miri tests for unsafe code, checked against both Stacked and Tree Borrows

Pathological user implementations written in safe Rust might corrupt
internal map state and result in panics, but should never cause UB.

If you see a gap in testing, new tests are welcome. Thank you!

Expand Down
10 changes: 7 additions & 3 deletions crates/iddqd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,13 @@
//!
//! * Unit tests
//! * Property-based tests using a naive map as an oracle
//! * Chaos tests for several kinds of buggy `Eq` and `Ord` implementations
//! * Explicit tests for panic safety in some scenarios
//! * Miri tests for unsafe code
//! * Unit and property-based tests for several kinds of pathological `Eq`,
//! `Hash` and `Ord` implementations
//! * Property-based tests for panic safety
//! * Miri tests for unsafe code, checked against both Stacked and Tree Borrows
//!
//! Pathological user implementations written in safe Rust might corrupt
//! internal map state and result in panics, but should never cause UB.
//!
//! If you see a gap in testing, new tests are welcome. Thank you!
//!
Expand Down
5 changes: 2 additions & 3 deletions crates/iddqd/src/support/btree_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,8 @@ where
move |a: &Index, b: &Index| {
let (a, b) = (a.value(), b.value());
if a == b {
// This is potentially load-bearing! It means that even if the Eq
// implementation on map items is wrong, we treat items at the same
// index as equal.
// This is load-bearing! It means that even if the Eq implementation
// on map items is wrong, we treat items at the same index as equal.
//
// Unsafe code relies on this to ensure that we don't return
// multiple mutable references to the same index.
Expand Down
2 changes: 2 additions & 0 deletions crates/iddqd/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ mod id_hash_map;
mod id_ord_map;
#[cfg(any(feature = "std", feature = "default-hasher"))]
mod panic_safety;
#[cfg(all(feature = "std", feature = "default-hasher"))]
mod pathological;
#[cfg(feature = "schemars08")]
mod schemars_tests;
#[cfg(all(
Expand Down
4 changes: 2 additions & 2 deletions crates/iddqd/tests/integration/panic_safety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ fn take_op_count() -> u32 {
OP_COUNT.with(|c| c.replace(0))
}

fn arm_panic_after(n: u32) {
pub(crate) fn arm_panic_after(n: u32) {
PANIC_COUNTDOWN.with(|c| c.set(Some(n)));
}

fn disarm_panic() {
pub(crate) fn disarm_panic() {
PANIC_COUNTDOWN.with(|c| c.set(None));
}

Expand Down
Loading
Loading