expression
Loom Builder: bounded exploration
Set an explicit preemption bound for a small example. A pass establishes only that no violation was found within the selected model and bound. It is not a universal correctness guarantee. Record the bound in test evidence. Staged Cargo test, not standalone Rust or a ByteMind exercise. Expected test outcome (not executed): PASS Common mistake: Reporting a bounded model pass as proof for all preemptions and thread counts.
Formal Syntax & Structure
rust syntaxrust
loom::model(|| { /* modeled operations */ });Working Example
Example Snippetrust
#[test]fn loom_model_bounds() { let mut builder = loom::model::Builder::new(); builder.preemption_bound = Some(2); builder.check(|| { use loom::{sync::{Arc, atomic::{AtomicBool, Ordering::Relaxed}}, thread}; let flag = Arc::new(AtomicBool::new(false)); let copy = flag.clone(); let t = thread::spawn(move || copy.store(true, Relaxed)); t.join().unwrap(); assert!(flag.load(Relaxed)); });}