Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for changes to the public API #656

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,032 changes: 1,032 additions & 0 deletions api/all-features.txt

Large diffs are not rendered by default.

897 changes: 897 additions & 0 deletions api/alloc.txt

Large diffs are not rendered by default.

901 changes: 901 additions & 0 deletions api/default-features.txt

Large diffs are not rendered by default.

923 changes: 923 additions & 0 deletions api/global-context.txt

Large diffs are not rendered by default.

804 changes: 804 additions & 0 deletions api/no-default-features.txt

Large diffs are not rendered by default.

32 changes: 32 additions & 0 deletions contrib/check-for-api-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
#
# Checks the public API of crates, exits with non-zero if there are currently
# changes to the public API not already committed to in the various api/*.txt
# files.

set -e

export RUSTDOCFLAGS='-A rustdoc::broken-intra-doc-links'
REPO_DIR=$(git rev-parse --show-toplevel)
API_DIR="$REPO_DIR/api"
CMD="cargo +nightly public-api --simplified"

# cargo public-api uses nightly so the toolchain must be available.
if ! cargo +nightly --version > /dev/null; then
echo "script requires a nightly toolchain to be installed (possibly >= nightly-2023-05-24)" >&2
exit 1
fi

pushd "$REPO_DIR" > /dev/null
$CMD --no-default-features | sort --unique > "$API_DIR/no-default-features.txt"
$CMD --no-default-features --features=alloc | sort --unique > "$API_DIR/alloc.txt"
$CMD | sort --unique > "$API_DIR/default-features.txt"
$CMD --features=global-context | sort --unique > "$API_DIR/global-context.txt"
$CMD --all-features | sort --unique > "$API_DIR/all-features.txt"

if [[ $(git status --porcelain api) ]]; then
echo "You have introduced changes to the public API, commit the changes to api/ currently in your working directory" >&2
else
echo "No changes to the current public API"
fi
popd > /dev/null
Loading