5. Proof plan
Why the target's own suite is not the drop-in proof here
The target crates keep their tests inside their MPL-licensed source modules; they cannot be run against another crate without editing them, and implementers may not read them. The drop-in claim therefore rests on three black-box proofs instead:
- Differential model tests (proptest). For each collection and flavour, a random sequence
of operations is applied to perennial, to imbl 7.0.2 and im/im-rc 15.1.0 (dev-dependencies,
used only as black-box oracles) and to a std model (
BTreeMap,HashMap,Vec). After every step, observable results must agree: return values,len, iteration order (ordered types and Vector),Debugstrings, equality and ordering between collections. Where the oracle and the spec disagree with each other,docs/COMPAT.mdrecords the case. - cargo's own test suite with perennial-rc in place of im-rc. CI checks out rust-lang/cargo
at a pinned commit (MIT OR Apache-2.0), changes its
im-rcline to{ package = "perennial-rc", path = … }, and runs the resolver tests and the cargo test targets that exercise resolution. This is the realistic drop-in proof: a large program using OrdMap, OrdSet, HashMap with a custom hasher, HashSet and the Entry API, unmodified. - Compile-level API compatibility. A test crate written from docs/spec/ calls every
documented method of im-rc 15.1.0 by path and signature; it must compile against
perennial-rc, and the same file againstim-rc(proves the test reflects the real API).
Unit and property tests
- Invariant checkers per structure (B+tree: sorted, balanced, fill bounds; HAMT: bitmap/storage agreement, canonical form after remove; RRB: size tables consistent, tail invariants), called after every step in debug test builds. Not in production paths.
- Structural sharing tests: after
clone+ mutate, the untouched handle is unchanged andptr_eqbehaves as documented. - Panic-safety and advisory tests (chapter 4). Miri on a reduced proptest budget.
Negative controls
Every new check is shown to fail once: break the code (e.g. skip a make_mut, off-by-one in a
split, wrong popcount rank), watch the check go red, restore, and record it in the PR that adds the check.
CI jobs
fmt, clippy -D warnings, test (stable, MSRV, Linux/macOS/Windows), Miri, fuzz smoke,
no_std build (--no-default-features for thumbv7em-none-eabi and wasm32-unknown-unknown),
cargo-suite, line guard (≤ 250 lines per file), unsafe guard, charts diff, docs build.