Skip to content

Documentation missing in "The [patch] section" #15948

@tliron

Description

@tliron

Problem

Currently "The [patch] section" mentions how you can override dependencies in Config.toml. Below, under "paths overrides" an alternative approach is documented for config.toml.

However, what the documentation does not make very clear is that you can also put a [patch] section in config.toml.

What the documentation does have is this tiny note:

Note: The [patch] table can also be specified as a configuration option, such as in a .cargo/config.toml file or a CLI option like --config 'patch.crates-io.rand.path="rand"'. This can be useful for local-only changes that you don’t want to commit, or temporarily testing a patch.

I think this could be made more prominent, and indeed made clear at the top of the section that [patch] can appear in either Cargo.toml or config.toml. I've referred to this documentation many times without noticing this tiny note revealing this important option!

Also, worth noting that the advantage of using config.toml over a CLI option is that IDEs and other tooling would also be able to pick up on the local-only patches, whereas a CLI option would not allow this.

Steps

No response

Possible Solution(s)

I think the option of using config.toml for [patch] should absolutely be mentioned at the very top of "The [patch] section" documentation!

Notes

No response

Version


Metadata

Metadata

Assignees

No one assigned

    Labels

    A-configurationArea: cargo config files and env varsA-documenting-cargo-itselfArea: Cargo's documentationA-patchArea: [patch] table overrideC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions