Rules / TAU-G001
No hidden global state
decided by Clippy kernel deny core deny edge –
Applies to tests: no
Exceptions:
#[expect] + reasonWhy
Global and thread-local state creates invisible coupling between calls and breaks test isolation.
Fix
Pass the state explicitly, or own it in a struct created by the edge.
What it checks
Banned in kernel, core (global or lazily initialised shared state), 5 types: std::sync::OnceLock, std::sync::LazyLock, once_cell::sync::Lazy, once_cell::sync::OnceCell, once_cell::unsync::Lazy
Banned in kernel, core (global or thread-local state), 2 macros: std::thread_local, lazy_static::lazy_static
Seen in fixtures
rej-global-state/src/lib.rs core
//! Hidden global state. use std::sync::OnceLock; static CACHE: OnceLock<u64> = OnceLock::new(); /// Cached value.#[must_use]pub fn cached() -> u64 { *CACHE.get_or_init(|| 7)}$ cargo tauten check
error[TAU-G001]: use of a disallowed type `std::sync::OnceLock` --> rej-global-state/src/lib.rs:3:1 (core crate `rej-global-state`) = rule: No hidden global state (decided by Clippy) = fix: Pass the state explicitly, or own it in a struct created by the edge. error[TAU-G001]: use of a disallowed type `std::sync::OnceLock` --> rej-global-state/src/lib.rs:5:15 (core crate `rej-global-state`) = rule: No hidden global state (decided by Clippy) = fix: Pass the state explicitly, or own it in a struct created by the edge. error[TAU-G001]: use of a disallowed type `std::sync::OnceLock` --> rej-global-state/src/lib.rs:5:31 (core crate `rej-global-state`) = rule: No hidden global state (decided by Clippy) = fix: Pass the state explicitly, or own it in a struct created by the edge.rej-global-state (core) expects TAU-G001. Output captured at 0200db3.In the terminal
cargo tauten explain TAU-G001$ cargo tauten explain TAU-G001
TAU-G001: No hidden global state Why: Global and thread-local state creates invisible coupling between calls and breaks test isolation. Fix: Pass the state explicitly, or own it in a struct created by the edge. Decided by: ClippyDecides: No banned global-state type or API (`static mut`, `thread_local!`, interior-mutable statics) outside the edge.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 deny edge -Banned (global or lazily initialised shared state): std::sync::OnceLock, std::sync::LazyLock, once_cell::sync::Lazy, once_cell::sync::OnceCell, once_cell::unsync::LazyBanned (global or thread-local state): std::thread_local, lazy_static::lazy_static