From: Peter Marheine Date: Mon, 8 Jan 2018 05:21:09 +0000 (+1100) Subject: Recover [patch] doc clarifications X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~3^2~55^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=97555df8564ee5fcbf53053a6f34a1b1bfb44b29;p=cargo.git Recover [patch] doc clarifications First added in 1700346a9e9fe36b6e5b6858fc9a03d63f4fa37e which failed to update the book and was replaced in 1271bb4de0c0e0a085be239c2418af9c673ffc87. --- diff --git a/src/doc/src/reference/manifest.md b/src/doc/src/reference/manifest.md index a29f2c5af..5dfa60f6a 100644 --- a/src/doc/src/reference/manifest.md +++ b/src/doc/src/reference/manifest.md @@ -738,19 +738,28 @@ other copies. The syntax is similar to the `[dependencies]` section: [patch.crates-io] foo = { git = 'https://github.com/example/foo' } bar = { path = 'my/local/bar' } + +[dependencies.baz] +git = 'https://github.com/example/baz' + +[patch.'https://github.com/example/baz'] +baz = { git = 'https://github.com/example/patched-baz', branch='my-branch' } ``` The `[patch]` table is made of dependency-like sub-tables. Each key after `[patch]` is a URL of the source that's being patched, or `crates-io` if you're modifying the https://crates.io registry. In the example above `crates-io` could be replaced with a git URL such as -`https://github.com/rust-lang-nursery/log`. +`https://github.com/rust-lang-nursery/log`; the second `[patch]` +section in the example uses this to specify a source called `baz`. Each entry in these tables is a normal dependency specification, the same as found in the `[dependencies]` section of the manifest. The dependencies listed in the `[patch]` section are resolved and used to patch the source at the URL specified. The above manifest snippet patches the `crates-io` source (e.g. -crates.io itself) with the `foo` crate and `bar` crate. +crates.io itself) with the `foo` crate and `bar` crate. It also +patches the `https://github.com/example/baz` source with a `my-branch` that +comes from elsewhere. Sources can be patched with versions of crates that do not exist, and they can also be patched with versions of crates that already exist. If a source is