From 622290e5f5e7c1e76f1366ac76912d5134e8d5a8 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Mon, 15 Mar 2021 13:51:33 -0700 Subject: [PATCH 1/3] Document the patch-in-config feature --- src/doc/src/reference/unstable.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 62458edb3a4..4035928635e 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -1156,3 +1156,27 @@ absolute path. TMPDIR = { value = "/home/tmp", force = true } OPENSSL_DIR = { value = "vendor/openssl", relative = true } ``` + +### `[patch]` in .cargo/config.toml +* Original Pull Request: [#9204](https://github.com/rust-lang/cargo/pull/9204) + +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. From 795931118ad9fa5d24a709ab6fe8ac410204a486 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Mon, 15 Mar 2021 13:53:28 -0700 Subject: [PATCH 2/3] Use feature name as heading --- src/doc/src/reference/unstable.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index 4035928635e..f2cac89cc94 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -1157,7 +1157,7 @@ TMPDIR = { value = "/home/tmp", force = true } OPENSSL_DIR = { value = "vendor/openssl", relative = true } ``` -### `[patch]` in .cargo/config.toml +### patch-in-config * Original Pull Request: [#9204](https://github.com/rust-lang/cargo/pull/9204) The `-Z patch-in-config` flag enables the use of `[patch]` sections in From 81116a9611d80e48d3b4f34d23e72c32c5476d21 Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Mon, 15 Mar 2021 13:55:29 -0700 Subject: [PATCH 3/3] Link tracking issue --- src/doc/src/reference/unstable.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md index f2cac89cc94..b1ef069074c 100644 --- a/src/doc/src/reference/unstable.md +++ b/src/doc/src/reference/unstable.md @@ -1159,6 +1159,7 @@ 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