docs.rs to Cut Default Build Targets by 80% Starting May 2026

By

Breaking Change: Fewer Default Build Targets

Starting May 1, 2026, docs.rs will drastically reduce the number of default build targets for Rust crate documentation. Instead of building for five targets by default, the platform will compile documentation for only the single default target unless additional targets are explicitly requested.

docs.rs to Cut Default Build Targets by 80% Starting May 2026
Source: blog.rust-lang.org

“This change is the natural next step in making docs.rs more efficient for the majority of crates,” said a docs.rs maintainer. “Most crates don’t compile different code for different targets, so by defaulting to a single target, we save time and resources.”

The decision, announced in advance to give crate authors time to adjust, is expected to cut build times and reduce server load significantly. The new policy applies only to new releases and rebuilds of existing releases.

Background: Years in the Making

The shift toward fewer default targets began in 2020, when docs.rs first introduced the ability for crate authors to opt out of the five-target build. At the time, the default remained unchanged, but the option provided a way to reduce unnecessary compilation.

Since then, the Rust project has seen that the vast majority of crates do not rely on target-specific conditional compilation. Building documentation for multiple targets when only one is needed wastes time and computing resources. This change makes the optimization the default.

“We’ve been gathering data for years, and the evidence is clear: building for five targets by default isn’t the right fit for most crates,” the maintainer added. “Moving to one target by default is better for everyone.”

What This Means for Crate Authors

If your crate uses cfg attributes, build scripts, or platform-specific dependencies that produce different documentation per target, you must now explicitly list the desired targets in your Cargo.toml. Otherwise, docs.rs will generate documentation only for the default target.

The default target remains x86_64-unknown-linux-gnu, matching docs.rs build servers. You can change this by setting the default-target field in your package metadata.

To build documentation for multiple targets, define the full list using the targets key. Once set, docs.rs will build for exactly those targets, ignoring the default. This change does not remove support for any target available in the Rust toolchain—only the default behavior changes.

Choosing the Default Target

If no default-target is specified, docs.rs uses x86_64-unknown-linux-gnu. You can override it with any target triple, such as x86_64-apple-darwin for macOS builds.

Add the following to your Cargo.toml:

[package.metadata.docs.rs]
default-target = "x86_64-apple-darwin"

Explicitly Requesting Additional Targets

If your crate’s documentation differs across platforms, you need a complete target list. For example, to include Windows and 32-bit Linux:

[package.metadata.docs.rs]
targets = [
    "x86_64-unknown-linux-gnu",
    "x86_64-apple-darwin",
    "x86_64-pc-windows-msvc",
    "i686-unknown-linux-gnu",
    "i686-pc-windows-msvc"
]

When the targets key is present, docs.rs ignores the default target and uses your list exclusively. The platform continues to support all targets available in the Rust toolchain.

Tags:

Related Articles

Recommended

Discover More

Unlocking the Web's Potential: The Block Protocol and the Future of Semantic DataDebian's Reproducible Builds Mandate: A Comprehensive Guide for Maintainers and UsersFrom Lab Marvels to Real-World Tools: The Hard Path for Bionic TechnologyPython Community Welcomes Packaging Council and Speedier 3.15 AlphaBrowser-Based PDF Compression: A JavaScript Q&A Guide