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

rerun if RUSTC changes #44

Closed
wants to merge 1 commit into from
Closed

Conversation

hkBst
Copy link

@hkBst hkBst commented Apr 5, 2024

Currently rustversion uses RUSTC to determine which executable to ask for a version. If RUSTC changes, then it is possible that the version information changes as well, so should rerun in that case.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you be able to share a sequence of cargo commands that shows the current implementation doing the wrong thing?

@hkBst
Copy link
Author

hkBst commented Apr 6, 2024

One such situation in which rustversion does the wrong thing is when you run:
cargo run then change to RUSTC=rustc_with_other_version_or_nightlyness cargo run. The second run will not pickup on the changed version because rustversion does not currently think it should rerun if RUSTC changed.

I can provide a test crate and a test wrapper for rustc if it helps.

The reason I am interested in this is that I currently have 1.76.0 installed but with nightly enabled. Since nightly has evolved since, I now need to disable nightly-detection by crates to avoid errors. There does not seem to be a direct way to do that, so I'd like to wrap rustc to change the way it reports its version.

@dtolnay
Copy link
Owner

dtolnay commented Apr 6, 2024

Cargo already runs $RUSTC -vV and re-runs all build scripts when the rustc version is changed. The relevant thing is the rustc version, not the $RUSTC environment variable. If $RUSTC changes but the rustc version does not, there is no need to rebuild. If $RUSTC does not change but the rustc version does, we do rebuild.

If the only issue is that your wrapper only recognizes -V and not -vV, then I would prefer not to accept this change.

@dtolnay dtolnay closed this Apr 6, 2024
@hkBst
Copy link
Author

hkBst commented Apr 6, 2024

Ah, indeed the wrapper started out not supporting "-vV". I will retest with that support. Thanks for the tip!

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

Successfully merging this pull request may close these issues.

None yet

2 participants