Skip to content
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

build.rs is not run after src/main.rs changed, when using cargo:rerun-if-env-changed #4901

Closed
ghost opened this issue Jan 5, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Jan 5, 2018

I made this simple project illustrate the issue: https://github.com/xftroxgpx/buildrs_not_updated
(just run ./go)

In simple terms:

  1. touch src/main.rs
  2. cargo build
    will not recompile build.rs because it used cargo:rerun-if-env-changed (doc)
    thus src/main.rs will use stale build.rs ...../output !
  3. remove the use of cargo:rerun-if-env-changed
  4. repeat steps 1 and 2.
    that recompiles build.rs every time you do step 4. now.

tested two versions of cargo:
cargo 0.26.0
release: 0.26.0
and
cargo 0.25.0-nightly (a88fbac 2017-12-29)
release: 0.25.0
commit-hash: a88fbac
commit-date: 2017-12-29

with rust:
rustc 1.24.0-dev (687d3d15b 2018-01-02)
binary: rustc
commit-hash: 687d3d15ba726dbb1ac6b85223ebe0e98c6820cc
commit-date: 2018-01-02
host: x86_64-unknown-linux-gnu
release: 1.24.0-dev
LLVM version: 4.0

@ghost ghost changed the title build.rs cached output is not updated after src/main.rs changed, when using cargo:rerun-if-env-changed build.rs is not run after src/main.rs changed, when using cargo:rerun-if-env-changed Jan 5, 2018
@alexcrichton
Copy link
Member

Thanks for the report! Is this perhaps the same bug as #4587?

@ghost
Copy link
Author

ghost commented Jan 5, 2018

Exactly! Thank you for spotting that! I forgot to search first, for some reason :)

I guess I'll close this in favor of that one

@ghost ghost closed this as completed Jan 5, 2018
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant