You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cargo doesn't rerun build scripts when RUSTC is changed #10367
This is currently intentional behavior. There are situations where RUSTC changes, but we don't want that to trigger a full recompile. If one rustc emits the same version output as another, then cargo assumes they essentially behave the same, even if they are from different paths. I'm not sure this is something that can be changed without causing unwanted recompiles in some situations.
If one rustc emits the same version output as another, then cargo assumes they essentially behave the same, even if they are from different paths.
To be clear, the original bug in x.py was that it cached the path from the build script and would try to run that compiler on all subsequent builds, which broke because the target directory was deleted.
They look like duplicates. I'm not sure if current behavior with x.py still would affect this. I wonder if we could set an environment variable, either to opt-in to full recompiles or opt-out of them depending on the desired default behavior when RUSTC changes, since it sounds like both are valid use-cases.
Activity
ehuss commentedon Feb 27, 2022
This is currently intentional behavior. There are situations where RUSTC changes, but we don't want that to trigger a full recompile. If one rustc emits the same version output as another, then cargo assumes they essentially behave the same, even if they are from different paths. I'm not sure this is something that can be changed without causing unwanted recompiles in some situations.
jyn514 commentedon Mar 1, 2022
Ok. Is it possible to document this somewhere? Maybe around https://doc.rust-lang.org/cargo/reference/build-scripts.html#rerun-if-env-changed ?
jyn514 commentedon Mar 1, 2022
To be clear, the original bug in x.py was that it cached the path from the build script and would try to run that compiler on all subsequent builds, which broke because the target directory was deleted.
epage commentedon Nov 7, 2025
I wonder how related #9983 is
Alexhuszagh commentedon Nov 10, 2025
They look like duplicates. I'm not sure if current behavior with
x.pystill would affect this. I wonder if we could set an environment variable, either to opt-in to full recompiles or opt-out of them depending on the desired default behavior when RUSTC changes, since it sounds like both are valid use-cases.epage commentedon Nov 10, 2025
Going to go ahead and close. If there is a reason for us to re-evaluate, let us know!
fix(ci): resolve cross-compilation GLIBC mismatch in release workflow