| // Copyright 2026 The Fuchsia Authors | |
| // | |
| // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0 | |
| // <LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0>, or the MIT | |
| // license <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your option. | |
| // This file may not be copied, modified, or distributed except according to | |
| // those terms. | |
| //! Zero-proc-macro declarative observable-trace recorder, padding-safe byte | |
| //! capture, validity-checked schedule materializer, and shadow provenance | |
| //! table. | |
| //! | |
| //! Uses safe Rust traits and `macro_rules!` with `core::mem::offset_of!` (zero | |
| //! `proc-macro` crates, zero `unsafe` padding reads, zero | |
| //! `MaybeUninit::assume_init`, and zero `#[repr(Rust)]` layout assumptions) so | |
| //! all traced structs, enums, and external call boundaries remain Miri-clean | |
| //! and compliant with Anneal's Cargo boundary policy. | |
| //! | |
| //! Architectural split: | |
| //! 1. **In-process library primitives** (`TraceRecorder`, `MaskedByte`, | |
| //! `ShadowProvenanceTable`, `ScopedAllocationGuard`, `traced_external_fn!`, | |
| //! and `run_with_trace_recorder`) support direct in-process Rust unit and | |
| //! integration tests without spawning subprocess compilers. | |
| //! 2. **Standalone subprocess runtime** (`render_embedded_trace_prelude`, | |
| //! emitting `mod anneal_rt`) is spliced into standalone single-file `rustc` | |
| //! (`-O0`/`-O2`) and `miri` binaries by `render_standalone_rust_harness` | |
| //! so subprocesses run with zero external crate dependencies. | |
| use std::{ | |
| cell::RefCell, | |
| collections::{BTreeMap, VecDeque}, | |
| fmt::{self, Write as _}, | |
| mem, | |
| num::{ | |
| NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize, NonZeroU8, | |
| NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize, | |
| }, | |
| panic::{self, AssertUnwindSafe}, | |
| }; | |
| use serde::{Deserialize, Deserializer, Serialize, Serializer}; | |
| use sha2::{Digest, Sha256}; | |
| mod capture; | |
| mod external_fn_macro; | |
| mod prelude; | |
| mod provenance; | |
| mod recorder; | |
| mod spine; | |
| mod type_macros; | |
| pub use capture::*; | |
| pub use prelude::*; | |
| pub use provenance::*; | |
| pub use recorder::*; | |
| pub use spine::*; |