Expand description
Fast compile-fail and compile-pass testing for Rust proc macros.
lihaaf is a trybuild-style test harness optimized for quick iteration.
It is designed for proc-macro crates that need many compile-pass and
compile-fail fixtures without paying unnecessary rebuild overhead.
lihaaf (“quilt”; Urdu and Punjabi, also written ਲਿਹਾਫ਼ in Gurmukhi)
compiles the consumer crate once as a dynamic
library, then runs each fixture as a standalone rustc invocation that
links the prebuilt dylib via --extern. In many real projects this is the
difference between waiting forever and getting quick feedback.
§Public surface
The exposed surface is intentionally CLI-shaped:
- The
cargo-lihaafbinary (Cargo subcommand convention; invoked ascargo lihaaf [OPTIONS]). [package.metadata.lihaaf]schema in the consumer’sCargo.toml(seeconfig::Config).- Verdict catalog (see
verdict::Verdict) and exit codes (seeexit::ExitCode). - A small set of crate-root re-exports for adopters who do want to
drive lihaaf from Rust:
Cli,Config,Verdict,ExitCode,Error,Outcome,run,Report. - Compat mode (
cargo lihaaf --compat): a migration workflow for trybuild fixture corpora that generates a deterministic JSON comparison envelope. The compat mode Rust API surface is intentionally#[doc(hidden)]; the supported entry is always the CLI.
All other modules are pub(crate) and may evolve freely across
v0.1.x point releases. Adopters who want to drive lihaaf from Rust
today should prefer the crate-root re-exports above (or
subprocess-spawn cargo lihaaf); the internal module paths are not
part of any v0.1 stability contract.
§What lives where
| Module | Responsibility |
|---|---|
cli | clap argument parsing, flag-to-action mapping. |
config | Parse + validate [package.metadata.lihaaf]. |
toolchain | Capture rustc --version --verbose for drift checks. (pub(crate)) |
dylib | cargo rustc --crate-type=dylib invocation, copy mechanic. (pub(crate)) |
suite_workspace | Opted-in staged Cargo workspace that builds fixture dev_deps beside the dylib. (pub(crate)) |
manifest | target/lihaaf/manifest.json schema + atomic write. (pub(crate)) |
freshness | Per-dispatch the policy invariant re-check (mtime / SHA-256 / rustc). (pub(crate)) |
lock | Session-wide advisory file lock on target/lihaaf/.session.lock. (pub(crate)) |
discovery | Walk fixture_dirs, classify pass/fail, sort. (pub(crate)) |
worker | Per-fixture rustc spawn, RSS sampling, OOM, timeout. (pub(crate)) |
normalize | Stderr normalization (fixed-string, byte-level). (pub(crate)) |
diff | Hand-rolled Myers diff with line granularity. (pub(crate)) |
snapshot | .stderr file I/O + --bless semantics. (pub(crate)) |
verdict | Per-fixture verdict + session reporter. |
exit | Exit-code mapping per the policy. |
session | Lifecycle orchestration (stages 1–9 of the policy). (pub(crate)) |
error | Crate-wide error type. (pub(crate)) |
util | Atomic file write + sha256 helpers. (pub(crate)) |
Re-exports§
Modules§
- cli
- CLI argument parsing.
- config
[package.metadata.lihaaf]parsing + validation.- exit
- Exit codes for the v0.1 stable contract.
- verdict
- Per-fixture verdict catalog.
Structs§
- Report
- Aggregate result of a session run.
Enums§
Constants§
- VERSION
- The semver-stable lihaaf release the binary identifies as.
Functions§
- run
- Run the full session.