What does cargo publish --all-features do

⚓ Rust    📅 2025-09-09    👤 surdeus    👁️ 9      

surdeus

Warning

This post was published 64 days ago. The information described in this article may have changed.

I'm sure I'm being a dunce here, but I'm having trouble understanding the difference between cargo publish and cargo publish --all-features. I created a "dummy" package with an intentionally ridiculous name to avoid name squatting something useful. Anyway, I can't find any observable difference on crates.io when I cargo publish with and without --all-features. I can't see any difference when I use cargo add or cargo install either. The following is a snippet of my Cargo.toml:

[[bin]]
name = <redacted_to_avoid_advertising_a_useless_crate>
required-features = ["fizz", "std"]

[features]
default = ["foo"]
std = []
foo = []
bar = []
fizz = []
buzz = []

I've published the package without having a default feature as well, and that doesn't change the behavior. When there is a default feature, cargo add and cargo install only enable that feature and crates.io only displays the features that are enabled by default as checked. Without a default feature, no features are used by cargo add or cargo install, and crates.io doesn't show any feature with a box checked.

5 posts - 2 participants

Read full topic

🏷️ Rust_feed