Skip to content

docs(r17): The Rust toolbox — example 48 + chapter 48 (Appendices: Tooling) - #17

Merged
patterncatalyst merged 3 commits into
mainfrom
docs/r17-rust-toolbox
Aug 7, 2026
Merged

patterncatalyst merged 3 commits into
mainfrom
docs/r17-rust-toolbox

Conversation

@patterncatalyst

Copy link
Copy Markdown
Owner

Rust analog of ch46/ch47 and the final chapter of Part 13. One zero-dependency crate (toolbox, edition 2024, channel 1.97.1) with every gate asserting a real tool-produced effect, never a bare exit code.

The structural point

rustfmt and clippy are rustup components of the pinned channel, so pinning the channel pins the formatter and the linter. That is why ch48's hard core covers formatting and linting offline, where ch47's gofumpt/golangci-lint could only ever be gated-if-present.

Hard gates (A–D) — offline, pinned toolchain only

gate both directions
A pin + digest rustup show reports the rust-toolchain.toml override; rustc --version == 1.97.1; toolbox report == 0x481984990deee5ff (byte-identical to ch46 C++ and ch47 Go)
B rustfmt cargo fmt --check clean on the module tree; rustfmt --check fixtures/misformatted.rs exits 1 with a diff (fixture is outside the module tree, so nothing compiles it)
C clippy cargo clippy --all-targets -- -D warnings clean by default; --features lintbait fails and names needless_return at src/lintbait.rs:13:5
D cargo test named digest unit test + test result: ok. 1 passed; 0 failed (not the exit code)

Gated-if-present (E–H)

cargo-nextest, cargo-deny, cargo-llvm-cov, cargo-audit — committed deny.toml/clippy.toml, informational SKIP: when absent, never checks.skip/FAIL. cargo-audit is double-guarded on the binary and on ~/.cargo/advisory-db, so a missing database is a skip rather than a mid-verification network clone.

Deviation from the plan (worth a look)

rust-toolchain.toml components trimmed from ["rustfmt", "clippy", "llvm-tools", "rust-src"] to ["rustfmt", "clippy"]. Pinning llvm-tools made rustup fetch it over the network on the first cargo invocation (info: downloading component llvm-tools), breaking the offline-build claim on a fresh host. Both omitted components are now a documented rustup component add opt-in, covered in the chapter's "What is deliberately not pinned" subsection, and the pipeline diagram was relabelled to match.

Verification (Fedora 44, kernel 7.1.5-201.fc44, offline, no cargo install)

  • LSP_LANG=rust lua verify.lua → PASS 20 / FAIL 0, 4 informational SKIPs
  • test-all-examples.py --only 48-rust-toolbox → 1 passed, 0 failed, 0 skipped
  • validate.py → OK; 15/15 chapter source blocks verbatim; banned-words clean
  • all three toolbox binaries (cpp/go/rust) re-run: same digest=0x481984990deee5ff

Details and the full gate matrix in _plans/r17-ch48-plan.md.

…oling)

Rust analog of ch46/ch47 and the final chapter of Part 13. One zero-dependency
crate (`toolbox`, edition 2024, channel 1.97.1) with every gate asserting a
real tool-produced effect, never a bare exit code.

Hard gates (A-D), all offline, all from the pinned toolchain alone:
- A rustup pin resolves (rustc 1.97.1) + report digest 0x481984990deee5ff,
  byte-identical to ch46's C++ and ch47's Go digest
- B cargo fmt --check clean on the module tree; rustfmt --check nonzero on
  fixtures/misformatted.rs (outside the module tree, so never compiled)
- C cargo clippy -D warnings clean by default; --features lintbait fires and
  names the stable needless_return lint
- D cargo test runs the named digest unit test asserting the literal

E-H (cargo-nextest/deny/llvm-cov/audit) ship committed configs and
skip-if-present gates; cargo-audit is double-guarded on the binary and on
~/.cargo/advisory-db so a missing database is a SKIP, not a failure.

Deviation from the plan: rust-toolchain.toml components trimmed to
["rustfmt", "clippy"] — pinning llvm-tools made rustup fetch it over the
network on the first cargo invocation, breaking the offline build claim on a
fresh host. Both llvm-tools and rust-src are now a documented
`rustup component add` opt-in.

Verified on Fedora 44 (kernel 7.1.5-201.fc44), offline: verify.lua
PASS 20 / FAIL 0 with 4 informational SKIPs, test-all-examples --only
48-rust-toolbox 1 passed, validate.py OK.
@patterncatalyst
patterncatalyst merged commit 6a3c714 into main Aug 7, 2026
8 checks passed
@patterncatalyst
patterncatalyst deleted the docs/r17-rust-toolbox branch August 7, 2026 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant