Watch
1
0
Fork
You've already forked rust-lang-cargo
0
mirror of https://github.com/rust-lang/cargo.git synced 2026-12-04 22:29:36 +01:00
The Rust package manager https://doc.rust-lang.org/cargo
  • Rust 96.1%
  • Roff 3.5%
  • JavaScript 0.2%
  • Shell 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Weihang Lo 188274cc81
perf(compile): On Mac, hardlink artifacts instead of copy (#17847)
### What does this PR try to resolve?

This has a fixed (over time) disk space reduction and reduces build time
overhead (especially important for no-op builds).
Particularly, cargo script (lots of no-op builds) and projects like Bevy
(175G of examples) will benefit.

This reverts commit c9c67c0a93 (#10196).
That was intended to fix #10060.
A lot has changed in macOS between 12.0.1 and 26.7.3, particularly it
appears that in XNU for macOS 15, they fixed a VFS bug where one file
name was used with a different path.
I cannot reproduce the problem with Cargo 1.59.

A lot has also changed in Cargo,
particularly we no longer append a hash to the binary name in the
build-dir,
making it less likely people can run into the original issue. It now
requires having `-` in the final binary name because the binary will
instead use `_` in the build-dir.

macOS 14.0 is now EOL but Rust still supports 11.0. In making this
change, we are degrading the behavior for a supported-but-EOL version of
macOS when running a binary that was immediately built (`cargo run`,
`cargo test`, `cargo bench`). This seems like an acceptable trade off.

Fixes #17467

### Notes to reviewers

If there is enough of an issue with the degraded cases, we could
possible do a "are these two files the same' check and skip the deletion
and re-link.

---

🤖 LLM involvement: none
2026-12-03 16:29:34 +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.5 2026-12-02 14:57:10 +00:00
benches refactor: rename homedir to cargo_home 2026-11-23 14:14:11 -05:00
ci refactor(help): embed man pages without a tarball 2026-10-24 20:49:48 -04:00
crates perf(compile): On Mac, hardlink artifacts instead of copy 2026-12-03 09:49:37 -06:00
credential refactor(credential)!: replace time with jiff 2026-11-16 21:42:26 -05:00
doc feat(timings): stabilize -Zmem-stats (#17826) 2026-12-02 02:56:30 +00:00
etc refactor: Rename internal content from target-triple to target-tuple 2026-09-29 10:19:51 -05:00
src doc: Updated stale build-dir documentation 2026-12-02 22:15:50 +09:00
tests test: name min-publish-age deps better 2026-12-02 16:58:30 -05: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 the delay-load list out of windows_manifest 2026-10-28 13:08:08 -07:00
Cargo.lock feat(cargo-util-config): expose config loader 2026-11-20 20:58:32 -05:00
Cargo.toml chore!: bump jiff to 1.0 2026-11-16 21:42:26 -05:00
CHANGELOG.md Fix changelog link 2025-02-04 06:11:14 -08:00
clippy.toml refactor(util): Move collection aliases into carg-util 2026-11-10 08:00:58 -06:00
CODE_OF_CONDUCT.md Add CoC 2023-01-25 10:18:15 +00:00
CONTRIBUTING.md docs: adopt rust-lang/rust's LLM usage policy 2026-08-07 22:38:46 -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 Update documentation about adding new publishable crates 2026-11-11 08:00:14 +01:00
README.md chore: Removed the Code Status section from README.md 2026-09-21 23:49:06 +09:00
rustfmt.toml Rustfmt 2024 2025-07-05 19:50:36 -07:00
triagebot.toml feat(config): Expose config merging, reading, and schemas in a crate 2026-11-10 08:01:28 -06:00
typos.toml chore: Allow secur32 in typos 2026-10-27 14:12:38 -07:00
windows.manifest.xml Add a windows manifest file 2023-12-07 14:24:58 +00:00

Cargo

Cargo downloads your Rust project’s 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.

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.

Code documentation: https://doc.rust-lang.org/nightly/nightly-rustc/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.