Skip to content

Decide if CARGO_HOME is truly cache or not #10252

@probablykasper

Description

@probablykasper

Problem

$CARGO_HOME (or ~/.cargo) is commonly described as just a cache. If it's a cache, it should be fine to delete it and exclude it from backups. If I delete ~/.cargo/bin, however, commands will stop working.

From reference/environment-variables.md:

  • CARGO_HOME — Cargo maintains a local cache of the registry index and of
    git checkouts of crates. By default these are stored under $HOME/.cargo
    (%USERPROFILE%\.cargo on Windows), but this variable overrides the
    location of this directory. Once a crate is cached it is not removed by the
    clean command.

From guide/cargo-home.md:

The "Cargo home" functions as a download and source cache.
When building a [crate][def-crate], Cargo stores downloaded build dependencies in the Cargo home.

Possible Solution(s)

  • If CARGO_HOME is cache, non-cache content should be stored elsewhere
  • If CARGO_HOME is not cache, update the documentation and decide where the cache actually should be stored so it can be easily and safely deleted or excluded from backups

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-documenting-cargo-itselfArea: Cargo's documentationC-bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions