Skip to content

Commit

Permalink
Auto merge of #9270 - jonhoo:document-patch-in-config, r=ehuss
Browse files Browse the repository at this point in the history
Document `-Zpatch-in-config`

Tracking issue: #9269
  • Loading branch information
bors committed Mar 15, 2021
2 parents 695465c + 81116a9 commit 434be94
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/doc/src/reference/unstable.md
Original file line number Diff line number Diff line change
Expand Up @@ -1156,3 +1156,28 @@ absolute path.
TMPDIR = { value = "/home/tmp", force = true }
OPENSSL_DIR = { value = "vendor/openssl", relative = true }
```

### patch-in-config
* Original Pull Request: [#9204](https://github.com/rust-lang/cargo/pull/9204)
* Tracking Issue: [#9269](https://github.com/rust-lang/cargo/issues/9269)

The `-Z patch-in-config` flag enables the use of `[patch]` sections in
cargo configuration files (`.cargo/config.toml`). The format of such
`[patch]` sections is identical to the one used in `Cargo.toml`.

Since `.cargo/config.toml` files are not usually checked into source
control, you should prefer patching using `Cargo.toml` where possible to
ensure that other developers can compile your crate in their own
environments. Patching through cargo configuration files is generally
only appropriate when the patch section is automatically generated by an
external build tool.

If a given dependency is patched both in a cargo configuration file and
a `Cargo.toml` file, the patch in `Cargo.toml` is used. If multiple
configuration files patch the same dependency, standard cargo
configuration merging is used, which prefers the value defined closest
to the current directory, with `$HOME/.cargo/config.toml` taking the
lowest precedence.

Relative `path` dependencies in such a `[patch]` section are resolved
relative to the configuration file they appear in.

0 comments on commit 434be94

Please sign in to comment.