Extract all public unsafe APIs (unsafe functions and unsafe traits) from the
Rust standard library crates core, alloc, and std, and save the
results to a static HTML table.
The script scans the local nightly rust-src component via rustdoc
JSON, collects every item that is both pub and unsafe, and writes a
five-column HTML table:
| Column | Content |
|---|---|
| (drag handle) | grab handle for reordering rows |
| Module | module path, e.g. core::ptr |
| API | full item path linked to stable rustdoc |
| Safety doc | text from the # Safety section of the item's docs |
| Confirmed ✓ | checkbox to mark an API as reviewed |
- Rust nightly toolchain:
rustup toolchain install nightly
- Rust standard-library source for that toolchain:
rustup component add rust-src --toolchain nightly
- Python 3 (3.8 or newer, no extra packages required).
Run the script from the repository root:
python3 scripts/extract_public_unsafe.pyThis will:
- Locate the
nightlysysroot withrustc --print sysroot. - Run
cargo rustdoc --output-format jsonforcore,alloc, andstd. - Parse each JSON file and collect public unsafe items.
- Write the results to
std-unsafe.htmlin the repository root. - Print the number of items written and the output path.
You can specify a custom output path:
python3 scripts/extract_public_unsafe.py my_output.htmlTo generate or refresh the site's home page locally:
python3 scripts/extract_public_unsafe.py docs/index.htmlThis is the same command the CI workflow runs automatically on every push to
main. You can also trigger it manually from the Actions tab →
Generate docs/index.html → Run workflow.
The site is served from the docs/ folder on the main branch.
- Go to Settings → Pages in this repository.
- Under Source, select Deploy from a branch.
- Choose branch
mainand folder/docs, then click Save.
Once enabled, the site is available at:
The docs/index.html file is regenerated automatically by the
Generate docs/index.html workflow on
every push to main.
- Nightly required: rustdoc JSON (
--output-format json) is a nightly-only unstable feature. - The script always uses the latest installed
nightlytoolchain. Results may change between nightly releases as the standard library evolves. Runrustup update nightlyto update to the current nightly before regenerating. - The first run is slower because cargo compiles the crates; subsequent runs reuse the build cache.