Skip to content

docs: convert doc examples to tested doctests#504

Merged
chaliy merged 3 commits intomainfrom
claude/rust-docs-examples-Av4F5
Mar 3, 2026
Merged

docs: convert doc examples to tested doctests#504
chaliy merged 3 commits intomainfrom
claude/rust-docs-examples-Av4F5

Conversation

@chaliy
Copy link
Contributor

@chaliy chaliy commented Mar 3, 2026

Summary

  • Convert 14 doc examples from rust,ignore to compiled/tested doctests across custom_builtins.md, threat-model.md, python.md, and logging.md
  • Fix pre-existing doc test failures: 3 network examples using .network() (behind http_client feature) in non-feature-gated modules now correctly use rust,ignore
  • Fix incorrect MountableFs::new() call in threat-model.md to match actual API signature
  • Add code example fencing rules and doctest guidance to specs/008-documentation.md

Test plan

  • cargo test --doc (no features) — 76 passed, 0 failed
  • cargo test --doc --all-features — 84 passed, 0 failed
  • cargo doc --no-deps builds without errors
  • just check (fmt + clippy + test) passes

claude added 3 commits March 3, 2026 14:14
Most code examples in the embedded docs (custom_builtins.md,
threat-model.md, python.md, logging.md) used `rust,ignore` fencing,
which meant rustdoc marked them as "not tested". Convert complete
examples to testable doctests using hidden `# ` boilerplate lines.
Fix MountableFs::new() call in threat-model.md to match actual API.

14 examples now compile-tested by `cargo test --doc --all-features`.
Examples using external crates (sqlx, reqwest, tracing-subscriber) or
feature-gated APIs in non-gated modules remain `rust,ignore`.

Update spec 008-documentation with fencing rules and doctest guidance.

https://claude.ai/code/session_01ALmXdnbcnFsF9EY3Aw8MLT
Three doc tests using .network() failed without http_client feature
since BashBuilder::network() is behind #[cfg(feature = "http_client")].
Change fencing to rust,ignore for these examples in non-feature-gated
modules (crate docs, compatibility.md, network mod docs).

https://claude.ai/code/session_01ALmXdnbcnFsF9EY3Aw8MLT
CI resolves to newer versions than what's in our Cargo.lock:
- getrandom 0.4.2 (safe-to-run)
- r-efi 6.0.0 (safe-to-deploy)
- tokio 1.50.0 (safe-to-deploy)

https://claude.ai/code/session_01ALmXdnbcnFsF9EY3Aw8MLT
@chaliy chaliy merged commit 486d6c4 into main Mar 3, 2026
17 checks passed
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.

2 participants