blob: 5bdab030bc2461e8749c4e7c1740d59b3752b054 [file] [edit]
#!/bin/bash
#
# Check that Rust documentation is generated without any warnings.
readonly SCRIPTS_DIR="$(dirname "$0")"
# shellcheck source=scripts/common
source "$SCRIPTS_DIR/common"
DOCS_OUT="$(cargo doc --document-private-items --no-deps 2>&1)"
# `cargo doc` produces warnings for incorrect paths. These warnings cannot be promoted to errors, so we use grep to detect them.
if grep --ignore-case --quiet --regexp='^warning' <<< "$DOCS_OUT"; then
echo "Warnings found when generating the docs."
exit 1
fi
# Check for any deadlinks in the generated docs.
if ! cargo deadlinks --dir target/doc; then
echo "Found deadlinks in the generated docs."
# TODO(#2007): Return error once invalid documentation from `tracing` crate is fixed.
exit 0
fi