artmap 0.6.0

A concurrent in-memory Adaptive Radix Tree (ART) featuring optimistic lock coupling.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
name: CI

permissions:
  contents: read

on:
  workflow_dispatch:
  # Called by the release workflow for the tagged commit (publish-gate).
  workflow_call:
  push:
    branches: [ main, next ]
  pull_request:
    branches: [ main, next ]

defaults:
  run:
    shell: bash

jobs:
  build-test:
    name: Build & Test (${{ matrix.target }})
    strategy:
      fail-fast: false
      matrix:
        target:
          - x86_64-unknown-linux-gnu
          - aarch64-unknown-linux-gnu
          - x86_64-pc-windows-msvc
          - x86_64-apple-darwin
          - aarch64-apple-darwin
        include:
          - target: x86_64-unknown-linux-gnu
            os: ubuntu-latest
          - target: aarch64-unknown-linux-gnu
            os: ubuntu-latest
          - target: x86_64-pc-windows-msvc
            os: windows-latest
          - target: x86_64-apple-darwin
            os: macos-latest
          - target: aarch64-apple-darwin
            os: macos-latest

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
        with:
          save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' }}

      - name: Install cross-compilation toolchain
        if: matrix.target == 'aarch64-unknown-linux-gnu'
        run: |
          sudo apt-get update
          sudo apt-get install -y gcc-aarch64-linux-gnu libc6-dev-arm64-cross
          echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
          echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> $GITHUB_ENV

      - name: Build
        run: cargo build --target ${{ matrix.target }} --verbose

      - name: Run tests
        if: matrix.target != 'aarch64-unknown-linux-gnu'
        run: cargo test --all-features --target ${{ matrix.target }} --verbose

  apple-targets:
    name: Apple Ecosystem (${{ matrix.target }})
    runs-on: macos-latest
    strategy:
      fail-fast: false
      matrix:
        target:
          - aarch64-apple-ios
          - aarch64-apple-ios-sim
          - aarch64-apple-tvos
          - aarch64-apple-tvos-sim
          - aarch64-apple-visionos
          - aarch64-apple-visionos-sim
          - aarch64-apple-watchos
          - aarch64-apple-watchos-sim
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: ${{ matrix.target }}

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
        with:
          save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' }}

      - name: Build
        run: cargo build --target ${{ matrix.target }}

  android-target:
    name: Android Ecosystem (aarch64-linux-android)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: aarch64-linux-android

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
        with:
          save-if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next' }}

      - name: Configure Android NDK toolchain
        run: |
          NDK_PATH="${ANDROID_NDK_LATEST_HOME:-$ANDROID_NDK_HOME}"
          if [ -z "$NDK_PATH" ] || [ ! -d "$NDK_PATH" ]; then
            NDK_PATH="$(ls -d /usr/local/lib/android/sdk/ndk/* 2>/dev/null | sort -V | tail -n 1)"
          fi
          TOOLCHAIN="$NDK_PATH/toolchains/llvm/prebuilt/linux-x86_64"
          CLANG_BIN="$(find "$TOOLCHAIN/bin" -name "aarch64-linux-android*-clang" | grep -v '++' | sort -V | tail -n 1)"
          LLVM_AR="$TOOLCHAIN/bin/llvm-ar"
          echo "CC_aarch64_linux_android=$CLANG_BIN" >> $GITHUB_ENV
          echo "AR_aarch64_linux_android=$LLVM_AR" >> $GITHUB_ENV
          echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_AR=$LLVM_AR" >> $GITHUB_ENV
          echo "CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$CLANG_BIN" >> $GITHUB_ENV

      - name: Build
        run: cargo build --target aarch64-linux-android

  oracle-fuzz:
    # Seeded sequential oracle fuzzing: map and oracle operations run under
    # one lock, so this checks results, not concurrency (see
    # tests/concurrent_correctness.rs and the loom models for that).
    name: Seeded oracle fuzzing
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run oracle fuzzing (multi-seed)
        run: |
          for seed in 1001 2002 3003 4004 5005; do
            echo "==> Running DST with seed ${seed}..."
            ARTMAP_SIM_SEED=${seed} cargo test --test sim -- --nocapture
            ARTMAP_SIM_SEED=${seed} cargo test --test versioned_simulation_tests -- --nocapture
          done

  wasm-check:
    name: WASM Check & Clippy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          targets: wasm32-unknown-unknown
          components: clippy

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Check WASM compilation
        run: cargo check --target wasm32-unknown-unknown

      - name: Run clippy (WASM)
        run: cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings

  format:
    name: Format
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: rustfmt

      - name: Check formatting
        run: cargo fmt --all -- --check

  clippy:
    name: Clippy
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
        with:
          components: clippy

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

  bench:
    name: Benchmark Compilation
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Check benchmarks compile
        run: cargo bench --no-run

  loom:
    # Models of the real latch, node and tree code (src/loom_tests.rs), with
    # mutant self-checks that must be caught (§16.3).
    name: Loom
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run loom models
        run: 'RUSTFLAGS="--cfg loom" cargo test --lib --release loom_tests::'

  miri-tb:
    # EBR suites under Tree Borrows; the default collector never frees its
    # Locals, hence -Zmiri-ignore-leaks (§16.1).
    name: Miri (Tree Borrows, ${{ matrix.target }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        # aarch64 covers the NEON Node16 path.
        target: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust with Miri
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23
          components: miri

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run Miri on the EBR suites
        env:
          MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-ignore-leaks -Zmiri-many-seeds=0..4
        run: >
          cargo miri test --target ${{ matrix.target }} --lib
          --test concurrent_correctness --test model --test unwind
          --test regressions --test drop_accounting --test panicking_drop
          --test linearizability --test proptest_keys --test byteslice_keys
          --test sim --test versioned_simulation_tests --test versioned_artmap_tests

      - name: Run Miri on the doctests
        env:
          MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-ignore-leaks
        run: cargo miri test --target ${{ matrix.target }} --doc

  miri-arena:
    # The arena suites never pin, so they run leak-checked, with strict
    # provenance and symbolic alignment, over several seeds (§16.1).
    name: Miri (arena, leak-checked)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust with Miri
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23
          components: miri

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run Miri on the arena suites
        env:
          MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-strict-provenance -Zmiri-symbolic-alignment-check -Zmiri-many-seeds=0..8
        run: cargo miri test --test arena_artmap_tests --test arena_regressions

  miri-strict:
    # Strict provenance for the units that do not touch crossbeam (§16.1).
    name: Miri (strict provenance units)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust with Miri
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23
          components: miri

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run Miri with strict provenance
        env:
          MIRIFLAGS: -Zmiri-tree-borrows -Zmiri-strict-provenance
        run: 'cargo miri test --lib -- raw::node:: raw::slot:: latch:: simd:: arena::'

  provenance-lints:
    # No integer-to-pointer or lossy pointer casts in artmap code (§16.2).
    name: Provenance lints
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23

      - name: Check with the provenance lints denied
        run: RUSTFLAGS="--cfg artmap_provenance_lints" cargo check --lib

  sanitizers:
    # TSan covers non-atomic accesses (leaf K/V, drop, dealloc); ASan with
    # LeakSanitizer covers memory errors and leaks (§16.4).
    name: Sanitizer (${{ matrix.sanitizer }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        sanitizer: [thread, address]
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23
          components: rust-src

      - name: Run the stress and race tests under the sanitizer
        env:
          RUSTFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
          RUSTDOCFLAGS: -Zsanitizer=${{ matrix.sanitizer }}
          TSAN_OPTIONS: halt_on_error=1
          ARTMAP_STRESS_MS: "1000"
        run: >
          cargo test -Zbuild-std --target x86_64-unknown-linux-gnu --release --lib
          --test concurrent_correctness --test concurrency_stress_tests
          --test regressions --test drop_accounting --test linearizability
          --test arena_regressions --test unwind -- --test-threads=1

  stress-release:
    name: Release-mode stress
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run the race tests for longer
        env:
          ARTMAP_STRESS_MS: "10000"
        run: cargo test --release --test concurrent_correctness --test concurrency_stress_tests --test arena_regressions

  compile-fail:
    # rustdoc checks `compile_fail,E....` codes only on nightly.
    name: Compile-fail doctests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run the doctests
        run: cargo test --doc

  msrv:
    # The library only: dev-dependencies need a newer toolchain.
    name: MSRV (1.86)
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust 1.86
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: "1.86"

      - name: Check the library
        run: cargo check --lib --all-features

  semver-checks:
    name: Semver checks
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Check semver
        uses: obi1kenobi/cargo-semver-checks-action@5b298c9520f7096a4683c0bd981a7ac5a7e249ae # v2

  public-api:
    # semver-checks catches removals, not re-exposure of sealed internals.
    name: Public API snapshot
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install nightly Rust
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # master
        with:
          toolchain: nightly-2026-09-23

      - name: Install cargo-public-api
        run: cargo install --locked cargo-public-api

      - name: Diff against the committed snapshot
        run: |
          cargo public-api --simplified > /tmp/public-api.txt
          if [ -f public-api.txt ]; then
            diff -u public-api.txt /tmp/public-api.txt
          else
            cat /tmp/public-api.txt
            echo "::warning::no public-api.txt snapshot committed yet; commit the output above"
          fi

  cargo-deny:
    name: Advisories
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Check advisories
        uses: EmbarkStudios/cargo-deny-action@3c6349835b2b7b196a839186cb8b78e02f7b5f25 # v2.1.1
        with:
          command: check advisories

  downstream-canary:
    # A memtable-style use of the arena API (range, versions(), try_insert,
    # size accessors), the shape surrealkv depends on.
    name: Downstream canary
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Install Rust toolchain
        uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable

      - name: Cache cargo dependencies
        uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2

      - name: Run the memtable example
        run: cargo run --release --example memtable

  unsafe-hygiene:
    # §5.2: acquisitions must bind their guard; a dropped guard unlocks.
    name: Latch-acquisition greps
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4

      - name: Reject unbound latch guards
        run: |
          ! grep -rnE 'let _ = .*\.(lock|try_upgrade)\(' src/
          ! grep -rnE '\.(lock|try_upgrade)\([^)]*\)\.is_(some|none)\(\)' src/