The Rust package manager https://doc.rust-lang.org/cargo
  • Rust 96%
  • Roff 3.6%
  • JavaScript 0.2%
  • Shell 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Ed Page c79e8f8944
fix(diag): Ensure diagnostic titles work without snippets (#17304)
### What does this PR try to resolve?

I noticed this while trying to elide a snippet in a test.

This is also important for short and no-graphics-mode.

### How to test and review this PR?
2026-08-04 19:17:33 +00:00
.cargo feat: Add a typos CI job 2025-11-12 10:39:43 -07:00
.github chore(deps): update embarkstudios/cargo-deny-action action to v2.1.1 (#17291) 2026-08-03 18:14:08 +00:00
benches chore: Update imports for workspace rename 2026-07-17 14:14:20 -05:00
ci chore: Move src/doc/ to doc/ 2026-07-17 11:20:52 -05:00
crates make __CARGO_TEST_FORCE_ARGFILE available in distributed builds 2026-08-01 11:22:07 +02:00
credential chore: Bump versions 2026-07-13 15:13:53 -05:00
doc docs(trim-paths): emit unremap files for final artifacts 2026-08-03 21:54:32 -04:00
etc Update cargo-fetch.md to remove cargo-prefetch reference (#16568) 2026-07-25 00:56:05 +00:00
src fix(diag): Ensure diagnostic titles work without snippets (#17304) 2026-08-04 19:17:33 +00:00
tests fix(diag): Ensure diagnostic titles work without snippets (#17304) 2026-08-04 19:17:33 +00:00
.git-blame-ignore-revs Ignore rustfmt 2024 commit 2025-07-05 19:51:10 -07:00
.gitignore chore: Move src/doc/ to doc/ 2026-07-17 11:20:52 -05:00
.ignore chore: Move src/doc/ to doc/ 2026-07-17 11:20:52 -05:00
build.rs chore: Move src/doc/ to doc/ 2026-07-17 11:20:52 -05:00
Cargo.lock chore: bump to libgit2-sys@0.18.7+1.9.6 2026-07-24 08:37:36 -04:00
Cargo.toml chore: Move src/cargo to src 2026-07-17 11:29:04 -05:00
CHANGELOG.md Fix changelog link 2025-02-04 06:11:14 -08:00
clippy.toml Disallow using stdlib's HashMap/HashSet and IndexMap/IndexSet data structures 2026-07-05 23:06:18 -04:00
CODE_OF_CONDUCT.md Add CoC 2023-01-25 10:18:15 +00:00
CONTRIBUTING.md docs: remove review capacity notice 2023-10-18 13:24:09 -04:00
deny.toml Update all dependencies 2025-02-09 15:50:36 -08:00
LICENSE-APACHE HTTPS all the things 2019-01-30 15:34:37 -05:00
LICENSE-MIT Remove inaccurate (misattributed) copyright notices 2017-07-26 17:19:24 -07:00
LICENSE-THIRD-PARTY HTTPS all the things 2019-01-30 15:34:37 -05:00
publish.py refactor(term): Create a no-op cargo-util-terminal 2026-03-27 16:51:48 -05:00
README.md docs(README): fix the link to the changelog in the Cargo book 2025-05-25 10:05:19 +00:00
rustfmt.toml Rustfmt 2024 2025-07-05 19:50:36 -07:00
triagebot.toml refactor(ops): Have cargo-metadata's ops match the command name 2026-07-17 16:07:32 -05:00
typos.toml chore(deps): update crate-ci/typos action to v1.40.0 2025-12-01 01:01:50 +00:00
windows.manifest.xml Add a windows manifest file 2023-12-07 14:24:58 +00:00

Cargo

Cargo downloads your Rust projects dependencies and compiles your project.

To start using Cargo, learn more at The Cargo Book.

To start developing Cargo itself, read the Cargo Contributor Guide.

The Cargo binary distributed through with Rust is maintained by the Cargo team for use by the wider ecosystem. For all other uses of this crate (as a binary or library) this is maintained by the Cargo team, primarily for use by Cargo and not intended for external use (except as a transitive dependency). This crate may make major changes to its APIs.

Code Status

CI

Code documentation: https://doc.rust-lang.org/nightly/nightly-rustc/cargo/

Compiling from Source

Requirements

Cargo requires the following tools and packages to build:

Other requirements:

The following are optional based on your platform and needs.

  • pkg-config — This is used to help locate system packages, such as libssl headers/libraries. This may not be required in all cases, such as using vendored OpenSSL, or on Windows.

  • OpenSSL — Only needed on Unix-like systems and only if the vendored-openssl Cargo feature is not used.

    This requires the development headers, which can be obtained from the libssl-dev package on Ubuntu or openssl-devel with apk or yum or the openssl package from Homebrew on macOS.

    If using the vendored-openssl Cargo feature, then a static copy of OpenSSL will be built from source instead of using the system OpenSSL. This may require additional tools such as perl and make.

    On macOS, common installation directories from Homebrew, MacPorts, or pkgsrc will be checked. Otherwise it will fall back to pkg-config.

    On Windows, the system-provided Schannel will be used instead.

    LibreSSL is also supported.

Optional system libraries:

The build will automatically use vendored versions of the following libraries. However, if they are provided by the system and can be found with pkg-config, then the system libraries will be used instead:

  • libcurl — Used for network transfers.
  • libgit2 — Used for fetching git dependencies.
  • libssh2 — Used for SSH access to git repositories.
  • libz (AKA zlib) — Used by the above C libraries for data compression. (Rust code uses zlib-rs instead.)

It is recommended to use the vendored versions as they are the versions that are tested to work with Cargo.

Compiling

First, you'll want to check out this repository

git clone https://github.com/rust-lang/cargo.git
cd cargo

With cargo already installed, you can simply run:

cargo build --release

Adding new subcommands to Cargo

Cargo is designed to be extensible with new subcommands without having to modify Cargo itself. See the Wiki page for more details and a list of known community-developed subcommands.

Releases

Cargo releases coincide with Rust releases. High level release notes are available as part of Rust's release notes. Detailed release notes are available in the changelog.

Reporting issues

Found a bug? We'd love to know about it!

Please report all issues on the GitHub issue tracker.

Contributing

See the Cargo Contributor Guide for a complete introduction to contributing to Cargo.

License

Cargo is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.

Third party software

This product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (https://www.openssl.org/).

In binary form, this product includes software that is licensed under the terms of the GNU General Public License, version 2, with a linking exception, which can be obtained from the upstream repository.

See LICENSE-THIRD-PARTY for details.