-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Cargo does not use rust-toolchain.toml
of separate project when executed within cargo run
#12292
Comments
If I understand correctly, You could add a line of |
I don't exactly know what you attempted to do, but there is an upcoming change that might affect things around rustup-cargo interaction. Just FYI. From 1.71.0 changelog:
|
Yeah, RUSTUP_TOOLCHAIN has the value "stable-x86_64-pc-windows-msvc" within the build script, as expected. I think the problem is that this value should change to "nightly-x86_64-pc-windows-msvc" within the subprocess that executes cargo for my subproject that has declared its Interestingly enough, this problem does not occur on my Ubuntu or macOS machines, only on Windows (msvc). |
Happy to provide more details if my "reproduction steps" are still too unclear. |
Thanks for the reply. The reproducer is pretty clear. However, I feel like there nothing is Cargo can do for this use case.
What you could do is, maybe, unsetting See rustup overrides for more. |
I appreciate you taking the time to look into this. I think part of the reason why I raised this issue is that its a discrepancy between different platforms. This issue only occurs on Windows. If a project has declared a |
Not really. I can reproduce it on Linux and macOS as well. If you cannot reproduce it on other platforms, check where the invoked
No. The child process inherits |
Oh, very interesting! In that case, I need to do some research on why I'm seeing the discrepancy... I'll do some research and report back. |
So, looks like that at my time of reproducing on other platforms, I had unintentionally left a (for debugging purposes) In other words, resetting RUSTUP_TOOLCHAIN had (as you warned), unexpected consequences in that it worked on other platforms, but not Windows. Anyway, if that's expected, then I think my issue has been sufficiently addressed. |
Okay then. I'll close this. If you find something very suspicious as a bug, let us know. Thank you :) |
For posterity: A workaround that is working for me (for now) is to clear |
A fix for Windows' behavior will be available in the next release of rustup via rust-lang/rustup#3178. Unfortunately it will be opt-in at first, but I hope the following release could turn it on by default. |
Problem
I am using a rust script to build a variety of separate subprojects.
One of these subprojects declares a
rust-toolchain.toml
that uses "nightly" rust.When I manually enter the directory, I see that nightly rust is being used.
When I use my rust script via
cargo run
, I see that stable rust is being used.Seems that it loads
rust-toolchain
at invocation and never again.Steps
subproj
with its ownCargo.toml
, as well as arust-toolchain.toml
with the following contentscargo run
Expected:
Should see the version is *-nightly
Actual:
Version was non-nightly
Possible Solution(s)
No response
Notes
Executing the build script binary (and hardcoding the subproject directory) results in no issues.
Version
The text was updated successfully, but these errors were encountered: