rerun-if-env-changed=CARGO_MANIFEST_DIR changing doesn't trigger a rebuild on change
Open
Nobody has claimed this yet.
A-build-scripts
A-environment-variables
A-rebuild-detection
S-needs-info
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
CARGO_MANIFEST_DIR changing doesn't trigger a rebuild, even if rerun-if-env-changed=CARGO_MANIFEST_DIR is specified in the build.rs.
Thus env!("CARGO_MANIFEST_DIR") and env::var("CARGO_MANIFEST_DIR").unwrap() can differ in binaries executed by cargo run/test/bench.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with a build.rs that specifies rerun-if-env-changed=CARGO_MANIFEST_DIR, then run the affected cargo run, cargo test, and cargo bench workflows. Done means changing CARGO_MANIFEST_DIR triggers a rebuild and env!("CARGO_MANIFEST_DIR") agrees with env::var("CARGO_MANIFEST_DIR").
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100