Subject
displaydoc is a proc-macro derive that generates core::fmt::Display
implementations for enums and structs based on the type's doc-comment
attributes. Shorthand format placeholders ({var}, {0}, {var:?})
inside the doc comment are rewritten into ordinary write! arguments.
With the std feature it additionally emits an autoref-specialisation
trick so that Path/PathBuf fields are printed via their .display()
methods. The crate is commonly used alongside thiserror.
Methodology
The published crate was diffed against the upstream Git checkout at the
commit recorded in .cargo_vcs_info.json. All four source files
(src/lib.rs, src/expand.rs, src/fmt.rs, src/attr.rs; ~890 lines)
were read in full. The integration-test tree under tests/ (split into
std/ and no_std/ parallel suites plus root-level cases) and the
trybuild-driven tests/compile_tests.rs were noted. The crate was
scanned for unsafe, extern, build scripts, binary artefacts, and
all forms of I/O.
Results
All source and test files are byte-identical between the published
crate and upstream. Cargo.toml differences are limited to cargo's
standard normalisation. The crate ships no binary artefacts (justifying
has-binaries), and no build.rs. The published artefact does include
an update-readme.sh shell script and a README.tpl template, but
these are release-tooling artefacts referenced from
[package.metadata.release].pre-release-hook and are not executed on
consumer install — they run only when the crate maintainer cuts a
release. They do not contribute to has-install-exec.
[lib] proc-macro = true makes the crate a proc-macro, the primary
reason has-build-exec = true. The proc-macro entry point is a single
#[proc_macro_derive(Display)] function (src/lib.rs:181). All work is
mechanical token rewriting via syn / quote / proc-macro2. The
hand-rolled format-string scanner in src/fmt.rs walks the literal
string a character at a time, recognising {name} / {N} /
{var:?} placeholders and emitting the corresponding write!
arguments — it allocates a single output String and does no I/O.
No unsafe blocks, no extern "C" declarations, no std::process,
std::net, std::fs, or std::env references appear anywhere in the
codebase. The proc-macro is purely deterministic and side-effect-free,
justifying uses-unsafe, uses-network, uses-filesystem,
uses-environment, uses-exec, uses-crypto, uses-jit,
uses-interpreter, uses-concurrency, impl-crypto, impl-parser,
impl-interpreter, impl-jit, impl-protocol, impl-datastructure,
impl-algorithm, impl-concurrency, build-exec-safe,
build-exec-deterministic, build-exec-no-network,
build-exec-no-write-out, build-exec-minimal, and is-benign.
Testing is supplied by a structured integration-test tree under
tests/: a std/ subdirectory and a parallel no_std/ subdirectory
(each covering enum_prefix, enum_prefix_missing, multi_line,
multi_line_allow, with/without); root-level happy.rs,
num_in_field.rs, and variantless.rs; and a trybuild harness in
compile_tests.rs. Together these justify has-integration-tests.
There are no in-source #[test] blocks, no fuzz, and no property
tests (has-unit-tests, has-fuzz-tests, has-property-tests).
No findings were recorded.
Conclusion
displaydoc is a focused proc-macro derive whose entire surface is
token rewriting plus a single small format-string scanner. The
published artefact contains a release-tooling shell script that is
inert at install time. No security, safety, correctness, or quality
concerns were identified.