-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document that cargo automatically registers variables used in env! macro to trigger rebuilds #15062
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @epage (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
Probably flaky. Return tests.
|
…cro to trigger rebuilds
Head branch was pushed to by a user without write access
I forgot to check here first and pushed to try to rerun the tests. |
Nah. I added the comment just for a record, since I clicked the rerun button in GitHub CI dashboard. |
Update cargo 13 commits in 088d496082726091024f1689c124a0c3dccbd775..045bf21b36a2e1f3ed85e38278d1c3cc4305e134 2025-01-10 20:10:21 +0000 to 2025-01-17 14:59:36 +0000 - created a function for user defined aliases (rust-lang/cargo#15076) - took the functionality of the third party subcommand from the list_commands function (rust-lang/cargo#15075) - fix: wrong concat and field name (rust-lang/cargo#15074) - fix(publish): Report all unpublishable packages (rust-lang/cargo#15070) - docs(cargo-clippy): correct typo (rust-lang/cargo#15072) - docs(cargo-package): alwasy include the lockfile (rust-lang/cargo#15067) - docs(ref): Deprecate 'package.authors' (rust-lang/cargo#15068) - fix(build-std): parse as comma-separated list (rust-lang/cargo#15065) - Fix benchsuite issue with newer versions of git (rust-lang/cargo#15069) - Document that cargo automatically registers variables used in env! macro to trigger rebuilds (rust-lang/cargo#15062) - perf(cargo-package): match certain path prefix with pathspec (rust-lang/cargo#14997) - Clarify note in example (rust-lang/cargo#15054) - chore(deps): update msrv (3 versions) to v1.82 (rust-lang/cargo#15050)
Update cargo 13 commits in 088d496082726091024f1689c124a0c3dccbd775..045bf21b36a2e1f3ed85e38278d1c3cc4305e134 2025-01-10 20:10:21 +0000 to 2025-01-17 14:59:36 +0000 - created a function for user defined aliases (rust-lang/cargo#15076) - took the functionality of the third party subcommand from the list_commands function (rust-lang/cargo#15075) - fix: wrong concat and field name (rust-lang/cargo#15074) - fix(publish): Report all unpublishable packages (rust-lang/cargo#15070) - docs(cargo-clippy): correct typo (rust-lang/cargo#15072) - docs(cargo-package): alwasy include the lockfile (rust-lang/cargo#15067) - docs(ref): Deprecate 'package.authors' (rust-lang/cargo#15068) - fix(build-std): parse as comma-separated list (rust-lang/cargo#15065) - Fix benchsuite issue with newer versions of git (rust-lang/cargo#15069) - Document that cargo automatically registers variables used in env! macro to trigger rebuilds (rust-lang/cargo#15062) - perf(cargo-package): match certain path prefix with pathspec (rust-lang/cargo#14997) - Clarify note in example (rust-lang/cargo#15054) - chore(deps): update msrv (3 versions) to v1.82 (rust-lang/cargo#15050)
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 forenv!
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 inbuild.rs
.