Rules / TAU-K001

Kernel determinism and purity

decided by Clippy kernel deny core – edge –
Applies to tests: no Exceptions: #[expect] + reason

Why

Kernel decisions must be deterministic and free of shared mutable state so they can be extracted and proved (Aeneas) and replayed exactly.

Fix

Use BTreeMap/BTreeSet and plain owned values; pass state explicitly.

What it checks

Banned in kernel (shared mutability or nondeterministic iteration in the kernel), 9 types: std::rc::Rc, std::rc::Weak, std::cell::RefCell, std::cell::Cell, std::sync::Arc, std::sync::Mutex, std::sync::RwLock, std::collections::HashMap, std::collections::HashSet

Seen in fixtures

rej-kernel-impure/src/lib.rs kernel

//! Kernel without no_std, using HashMap and floats. use std::collections::HashMap; /// Count keys.#[must_use]pub fn count(map: &HashMap<u8, u8>) -> usize {    map.len()} /// Average.#[must_use]pub fn half(x: f64) -> f64 {    x / 2.0}

$ cargo tauten check

error[TAU-K001]: use of a disallowed type `std::collections::HashMap`  --> rej-kernel-impure/src/lib.rs:3:1 (kernel crate `rej-kernel-impure`)  = rule: Kernel determinism and purity (decided by Clippy)  = fix: Use `BTreeMap`/`BTreeSet` and plain owned values; pass state explicitly. error[TAU-K001]: use of a disallowed type `std::collections::HashMap`  --> rej-kernel-impure/src/lib.rs:7:20 (kernel crate `rej-kernel-impure`)  = rule: Kernel determinism and purity (decided by Clippy)  = fix: Use `BTreeMap`/`BTreeSet` and plain owned values; pass state explicitly.
Fixture rej-kernel-impure (kernel) expects TAU-K003, TAU-K001, TAU-N003. Output captured at 0200db3.

In the terminal

cargo tauten explain TAU-K001

$ cargo tauten explain TAU-K001

TAU-K001: Kernel determinism and purity Why: Kernel decisions must be deterministic and free of shared mutable state so they can be extracted and proved (Aeneas) and replayed exactly. Fix: Use `BTreeMap`/`BTreeSet` and plain owned values; pass state explicitly. Decided by: ClippyDecides: No banned non-deterministic or impure API in kernel crates.Sees: resolved; complete: yesDoes not see: Code expanded from macros defined in other crates (clippy skips it); code disabled by `cfg`; build scripts. APIs not on the tier's ban list (clippy.toml), including dependency functions that wrap a banned one; foreign code.Applies to tests: noExceptions allowed: with #[expect(.., reason)]  kernel deny  core -  edge -Banned (shared mutability or nondeterministic iteration in the kernel): std::rc::Rc, std::rc::Weak, std::cell::RefCell, std::cell::Cell, std::sync::Arc, std::sync::Mutex, std::sync::RwLock, std::collections::HashMap, std::collections::HashSet