Cargo-Geiger

Hacker News Top Tools

Summary

cargo-geiger is a Rust cargo plugin that lists statistics about unsafe code usage in a crate and its dependencies, providing input for auditing.

No content available
Original Article
View Cached Full Text

Cached at: 06/20/26, 05:16 PM

geiger-rs/cargo-geiger

Source: https://github.com/geiger-rs/cargo-geiger

cargo-geiger ☢️

CI unsafe forbidden crates.io Crates.io

A tool that lists statistics related to the usage of unsafe Rust code in a Rust crate and all its dependencies.

This cargo plugin was originally based on the code from two other projects:

Installation

Try to find and use a system-wide installed OpenSSL library:

cargo install --locked cargo-geiger

Or, build and statically link OpenSSL as part of the cargo-geiger executable:

cargo install --locked cargo-geiger --features vendored-openssl

Alternatively pre-built binary releases are available from GitHub releases.

Usage

  1. Navigate to the same directory as the Cargo.toml you want to analyze.
  2. cargo geiger

Intended Use

This tool is not meant to advise directly whether the code ultimately is truly insecure or not.

The purpose of cargo-geiger is to provide statistical input to auditing e.g. with:

The use of unsafe is nuanced and necessary in some cases and any motivation to use it is outside the scope of cargo-geiger.

It is important that any reporting is handled with care:

Output example

Example output

Known issues

Libraries

Cargo Geiger exposes three libraries:

  • cargo-geiger - Unversioned and highly unstable library exposing the internals of the cargo-geiger binary. As such, any function contained within this library may be subject to change.
  • cargo-geiger-serde - A library containing the serializable report types
  • geiger - A library containing a few decoupled cargo components used by cargo-geiger

Changelog

See the changelog.

Why the name?

https://en.wikipedia.org/wiki/Geiger_counter

Unsafe code, like ionizing radiation, is unavoidable in some situations and should be safely contained!

Similar Articles

Build your project Zig-style

Lobsters Hottest

The author details building a tool called bygge-zig that uses the Zig build system to compile Rust projects, replicating Cargo's functionality in far fewer lines of code, highlighting the differences and challenges.

Garbage Collection Without Unsafe Code

Hacker News Top

safe-gc is a new Rust crate that provides a garbage collector implemented entirely without unsafe code, using heap-indexing instead of direct pointer dereferencing to maintain memory safety.

The Edge of Safe Rust

Lobsters Hottest

A TokioConf 2026 talk/blog post explores pushing safe Rust to its limits by implementing tracing garbage collection for complex pointer structures, sharing techniques for circular references and raw-pointer GC design.