Skip to content

Commit 7d6172d

Browse files
committed
docs(config): target.triple.rustdocflags
1 parent 652a841 commit 7d6172d

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

src/doc/src/reference/config.md

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,10 @@ tag = "…" # tag name for the git repository
158158
rev = "" # revision for the git repository
159159

160160
[target.<triple>]
161-
linker = "" # linker to use
162-
runner = "" # wrapper to run executables
163-
rustflags = ["", ""] # custom flags for `rustc`
161+
linker = "" # linker to use
162+
runner = "" # wrapper to run executables
163+
rustflags = ["", ""] # custom flags for `rustc`
164+
rustdocflags = ["", ""] # custom flags for `rustdoc`
164165

165166
[target.<cfg>]
166167
runner = "" # wrapper to run executables
@@ -500,15 +501,22 @@ appropriate profile setting.
500501
Extra command-line flags to pass to `rustdoc`. The value may be an array of
501502
strings or a space-separated string.
502503

503-
There are three mutually exclusive sources of extra flags. They are checked in
504+
There are four mutually exclusive sources of extra flags. They are checked in
504505
order, with the first one being used:
505506

506507
1. `CARGO_ENCODED_RUSTDOCFLAGS` environment variable.
507508
2. `RUSTDOCFLAGS` environment variable.
508-
3. `build.rustdocflags` config value.
509+
3. All matching `target.<triple>.rustdocflags` config entries joined together.
510+
4. `build.rustdocflags` config value.
509511

510512
Additional flags may also be passed with the [`cargo rustdoc`] command.
511513

514+
> **Caution**: Due to the low-level nature of passing flags directly to the
515+
> compiler, this may cause a conflict with future versions of Cargo which may
516+
> issue the same or similar flags on its own which may interfere with the
517+
> flags you specify. This is an area where Cargo may not always be backwards
518+
> compatible.
519+
512520
#### `build.incremental`
513521
* Type: bool
514522
* Default: from profile
@@ -1216,6 +1224,17 @@ This is similar to the [target rustflags](#targettriplerustflags), but
12161224
using a [`cfg()` expression]. If several `<cfg>` and [`<triple>`] entries
12171225
match the current target, the flags are joined together.
12181226

1227+
#### `target.<triple>.rustdocflags`
1228+
* Type: string or array of strings
1229+
* Default: none
1230+
* Environment: `CARGO_TARGET_<triple>_RUSTDOCFLAGS`
1231+
1232+
Passes a set of custom flags to the compiler for this [`<triple>`].
1233+
The value may be an array of strings or a space-separated string.
1234+
1235+
See [`build.rustdocflags`](#buildrustdocflags) for more details on the different
1236+
ways to specific extra flags.
1237+
12191238
#### `target.<triple>.<links>`
12201239

12211240
The links sub-table provides a way to [override a build script]. When

0 commit comments

Comments
 (0)