Skip to content

Commit 75e2a12

Browse files
committed
Document that cargo automatically registers variables used in env! macro to trigger rebuilds
1 parent 9589831 commit 75e2a12

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,13 @@ variables like `TARGET` that [Cargo sets for build scripts][build-env]. The
403403
environment variables in use are those received by `cargo` invocations, not
404404
those received by the executable of the build script.
405405

406+
As of 1.46, using [`env!`][env-macro] and [`option_env!`][option-env-macro] in
407+
source code will automatically detect changes and trigger rebuilds.
408+
`rerun-if-env-changed` is no longer needed for variables already referenced by
409+
these macros.
410+
411+
[option-env-macro]: ../../std/macro.option_env.html
412+
406413
## The `links` Manifest Key
407414

408415
The `package.links` key may be set in the `Cargo.toml` manifest to declare

0 commit comments

Comments
 (0)