cargo-manifest

Publication allowlists and package contents

Protect private packages from unintended publication. An explicit allowlist can limit acceptable registries. Review include/exclude rules separately; publication policy does not itself protect secrets from local archives. Example format: toml. Illustrative only; do not execute against real accounts or unreviewed sources. Expected result (not executed): Manifest fragment restricts publication and defines package content selection; Cargo may include additional generated metadata. Common mistake: Assuming publish = false encrypts files or prevents copying the source.

Formal Syntax & Structure

rust syntaxrust
[package] publish = false

Working Example

Example Snippetrust
[package]name = "private-lab"version = "0.1.0"edition = "2024"publish = falseinclude = ["src/**", "Cargo.toml", "README.md"]
Rust Reference