Closed
Description
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
- Create a build script with the following contents
fn main() {
let root_dir = path::PathBuf::from(
env::var("CARGO_MANIFEST_DIR").expect("Must be run via Cargo to establish root directory"),
);
let mut subproj_dir = root_dir;
subproj_dir.push("subproj");
let output = process::Command::new("sh")
.arg("-c")
.arg("cargo --version")
.current_dir(subproj_dir)
.output()
.unwrap();
println!("out: {}", from_utf8(&output.stdout).unwrap());
println!("err: {}", from_utf8(&output.stderr).unwrap());
}
- Create a subproject in a folder called
subproj
with its ownCargo.toml
, as well as arust-toolchain.toml
with the following contents
[toolchain]
channel = "nightly"
- From the top-level project,
cargo 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
cargo 1.70.0 (ec8a8a0ca 2023-04-25)
release: 1.70.0
commit-hash: ec8a8a0cabb0e0cadef58902470f6c7ee7868bdc
commit-date: 2023-04-25
host: x86_64-pc-windows-msvc
libgit2: 1.6.3 (sys:0.17.0 vendored)
libcurl: 8.0.1-DEV (sys:0.4.61+curl-8.0.1 vendored ssl:Schannel)
os: Windows 10.0.22621 (Windows 10 Pro) [64-bit]