Commit 1b77ac6
authored
Document that cargo automatically registers variables used in env! macro to trigger rebuilds (#15062)
Initially discussed in
https://rust-lang.zulipchat.com/#narrow/channel/246057-t-cargo/topic/env!.2Foption_env!.20are.20tracked.2C.20can.20documentation.20be.20improved.3F/near/491793318
### What does this PR try to resolve?
There is no documentation that I can find which indicates that cargo
will rebuild for changes in the variables used in `env!` macros.
Because this was not always the case, when searching for information on
this, the main result indicates otherwise
https://users.rust-lang.org/t/should-env-cause-rebuild-is-env-var-changes/18013.
Users misled by this may turn to `rerun-if-changed-env` in a build
script to trigger rebuilds, so this documentation is a useful place to
catch users and indicate that it isn't needed for `env!` macros.
### How should we test and review this PR?
I'm not sure how to test the new relative link but I matched it to the
existing `[env-macro]: ../../std/macro.env.html`.
My main concern when writing this was whether it was clear that this
applies to `env!` macro usage within the main code of the crate and not
just in `build.rs`.1 file changed
+7
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
406 | 413 | | |
407 | 414 | | |
408 | 415 | | |
| |||
0 commit comments