Skip to content

Commit 1607a68

Browse files
committed
Add note about cargo:rustc-env variables set at runtime.
1 parent d8673d9 commit 1607a68

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/doc/src/reference/build-scripts.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,12 @@ unique identifier of a continuous integration server.
192192
See also the [environment variables automatically included by
193193
Cargo][env-cargo].
194194

195+
> **Note**: These environment variables are also set when running an
196+
> executable with `cargo run` or `cargo test`. However, this usage is
197+
> discouraged since it ties the executable to Cargo's execution environment.
198+
> Normally, these environment variables should only be checked at compile-time
199+
> with the `env!` macro.
200+
195201
[env-macro]: ../../std/macro.env.html
196202
[env-cargo]: environment-variables.md#environment-variables-cargo-sets-for-crates
197203

0 commit comments

Comments
 (0)