Skip to content

Commit 26a499b

Browse files
committed
Improve CARGO_ENCODED_RUSTFLAGS and CARGO_ENCODED_RUSTDOCFLAGS variables docs
Signed-off-by: hi-rustin <[email protected]>
1 parent 05a53e7 commit 26a499b

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

src/doc/src/reference/config.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -363,18 +363,19 @@ Can be overridden with the `--target-dir` CLI option.
363363
##### `build.rustflags`
364364
* Type: string or array of strings
365365
* Default: none
366-
* Environment: `CARGO_BUILD_RUSTFLAGS` or `RUSTFLAGS`
366+
* Environment: `CARGO_BUILD_RUSTFLAGS` or `CARGO_ENCODED_RUSTFLAGS` or `RUSTFLAGS`
367367

368368
Extra command-line flags to pass to `rustc`. The value may be a array of
369369
strings or a space-separated string.
370370

371371
There are three mutually exclusive sources of extra flags. They are checked in
372372
order, with the first one being used:
373373

374-
1. `RUSTFLAGS` environment variable.
375-
2. All matching `target.<triple>.rustflags` and `target.<cfg>.rustflags`
374+
1. `CARGO_ENCODED_RUSTFLAGS` environment variable.
375+
2. `RUSTFLAGS` environment variable.
376+
3. All matching `target.<triple>.rustflags` and `target.<cfg>.rustflags`
376377
config entries joined together.
377-
3. `build.rustflags` config value.
378+
4. `build.rustflags` config value.
378379

379380
Additional flags may also be passed with the [`cargo rustc`] command.
380381

@@ -399,16 +400,17 @@ appropriate profile setting.
399400
##### `build.rustdocflags`
400401
* Type: string or array of strings
401402
* Default: none
402-
* Environment: `CARGO_BUILD_RUSTDOCFLAGS` or `RUSTDOCFLAGS`
403+
* Environment: `CARGO_BUILD_RUSTDOCFLAGS` or `CARGO_ENCODED_RUSTDOCFLAGS` or `RUSTDOCFLAGS`
403404

404405
Extra command-line flags to pass to `rustdoc`. The value may be a array of
405406
strings or a space-separated string.
406407

407408
There are two mutually exclusive sources of extra flags. They are checked in
408409
order, with the first one being used:
409410

410-
1. `RUSTDOCFLAGS` environment variable.
411-
2. `build.rustdocflags` config value.
411+
1. `CARGO_ENCODED_RUSTDOCFLAGS` environment variable.
412+
2. `RUSTDOCFLAGS` environment variable.
413+
3. `build.rustdocflags` config value.
412414

413415
Additional flags may also be passed with the [`cargo rustdoc`] command.
414416

src/doc/src/reference/environment-variables.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,18 @@ system:
3636
invocations that Cargo performs. In contrast with [`cargo rustdoc`], this is
3737
useful for passing a flag to *all* `rustdoc` instances. See
3838
[`build.rustdocflags`] for some more ways to set flags. This string is
39-
split by whitespace; for a more robust encoding of multiple arguments,
40-
set `CARGO_ENCODED_RUSTDOCFLAGS` instead with arguments separated by
41-
`0x1f` (ASCII Unit Separator).
39+
split by whitespace; for a more robust encoding of multiple arguments,
40+
see `CARGO_ENCODED_RUSTDOCFLAGS`.
41+
* `CARGO_ENCODED_RUSTDOCFLAGS` - A list of custom flags separated by `0x1f`
42+
(ASCII Unit Separator) to pass to all `rustdoc` invocations that Cargo performs.
4243
* `RUSTFLAGS` — A space-separated list of custom flags to pass to all compiler
4344
invocations that Cargo performs. In contrast with [`cargo rustc`], this is
4445
useful for passing a flag to *all* compiler instances. See
4546
[`build.rustflags`] for some more ways to set flags. This string is
46-
split by whitespace; for a more robust encoding of multiple arguments,
47-
set `CARGO_ENCODED_RUSTFLAGS` instead with arguments separated by
48-
`0x1f` (ASCII Unit Separator).
47+
split by whitespace; for a more robust encoding of multiple arguments,
48+
see `CARGO_ENCODED_RUSTFLAGS`.
49+
* `CARGO_ENCODED_RUSTFLAGS` - A list of custom flags separated by `0x1f`
50+
(ASCII Unit Separator) to pass to all compiler invocations that Cargo performs.
4951
* `CARGO_INCREMENTAL` — If this is set to 1 then Cargo will force [incremental
5052
compilation] to be enabled for the current compilation, and when set to 0 it
5153
will force disabling it. If this env var isn't present then cargo's defaults

0 commit comments

Comments
 (0)