cargo-bisect-rustc
cargo-bisect-rustc copied to clipboard
no such subcommand: +<toolchain>
Hey all,
Just trying out cargo-bisect-rustc today. When I try to run:
cargo bisect-rustc --test-dir . --start=801821d15 --end=40336865f --regress error --preserve -vv -- version
(I was trying an actual build command but simplifying the failure to running version)
It seems to have trouble running cargo with the newly added toolchain:
bisecting ci builds
starting at 801821d15, ending at 40336865f
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
fetching (via local git) commits from 801821d15 to 40336865fe7d4a01139a3336639c6971647e885c
opening existing repository at "rust.git"
Found origin remote under name `origin`
refreshing repository at "rust.git"
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 8 bors merge commits in the specified range
commit[0] 2022-08-14UTC: Auto merge of #100429 - GuillaumeGomez:merge-html-elements-together, r=notriddle
commit[1] 2022-08-14UTC: Auto merge of #100540 - matthiaskrgr:rollup-734hkpt, r=matthiaskrgr
commit[2] 2022-08-15UTC: Auto merge of #100510 - compiler-errors:as-a-treat, r=jackh726
commit[3] 2022-08-15UTC: Auto merge of #96350 - austinabell:skip_optimization, r=Mark-Simulacrum
commit[4] 2022-08-15UTC: Auto merge of #96745 - ehuss:even-more-attribute-validation, r=cjgillot
commit[5] 2022-08-15UTC: Auto merge of #98393 - michaelwoerister:new-cpp-like-enum-debuginfo, r=wesleywiser
commit[6] 2022-08-15UTC: Auto merge of #100569 - matthiaskrgr:rollup-9450lzs, r=matthiaskrgr
commit[7] 2022-08-15UTC: Auto merge of #100595 - matthiaskrgr:rollup-f1zur58, r=matthiaskrgr
validated commits found, specifying toolchains
checking the start range to verify it passes
installing 801821d1560f84e4716fcbd9244ec959320a13d5
testing...
error: no such subcommand: `+bisector-ci-801821d1560f84e4716fcbd9244ec959320a13d5-x86_64-pc-windows-msvc`
Cargo does not handle `+toolchain` directives.
Did you mean to invoke `cargo` through `rustup` instead?
RESULT: 801821d1560f84e4716fcbd9244ec959320a13d5, ===> Yes
The toolchain is installed, though, and I'm able to run it directly via cargo +bisector-ci-801821d1560f84e4716fcbd9244ec959320a13d5-x86_64-pc-windows-msvc version.
My guess would be that there is an issue with the PATH environment variable. cargo-bisect-rustc just executes the command "cargo" from your PATH (although the lookup rules on windows is complicated), it doesn't use the one from the downloaded toolchains.
I'd verify that ~/.cargo/bin is first in your PATH. It might also help to report which version of cargo-bisect-rustc you are using, and which version of Rust you used to build it.
I just tested on my machine and have the same problem.
cargo bisect-rustc -- version
checking the start range to find a passing nightly
installing nightly-2023-01-22
rust-std-nightly-x86_64-pc-windows-msvc: 27.22 MB / 27.22 MB testing...
RESULT: nightly-2023-01-22, ===> Yes
uninstalling nightly-2023-01-22
checking the start range to find a passing nightly
installing nightly-2023-01-20
rust-std-nightly-x86_64-pc-windows-msvc: 27.18 MB / 27.18 MB esting...
RESULT: nightly-2023-01-20, ===> Yes
uninstalling nightly-2023-01-20
checking the start range to find a passing nightly
installing nightly-2023-01-18
rust-std-nightly-x86_64-pc-windows-msvc: 27.14 MB / 27.14 MB testing...
RESULT: nightly-2023-01-18, ===> Yes
uninstalling nightly-2023-01-18
where cargo executed cmd returns C:\Users\user\.cargo\bin\cargo.exe but Command::new() returns
C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\cargo.exe
C:\Users\user\.cargo\bin\cargo.exe
Running cargo-bisect-rustc -vv -- verison instead of cargo bisect-rustc -vv -- verison fixes the issue. Apparently if command is run through cargo some additional paths are prepended to path: C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib;C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin;
Can you show which version of rustup you have and what your PATH looks like? I suspect it is https://github.com/rust-lang/rustup/issues/3036, and it may be an issue with PATH.
rustup --version
rustup 1.25.1 (bb60b1e89 2022-07-12)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.66.0 (69f9c33d7 2022-12-12)`
My path is:
C:\Program Files\Common Files\Oracle\Java\javapath;C:\Program Files\Eclipse Adoptium\jre-8.0.332.9-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-17.0.3.7-hotspot\bin;C:\Program Files\Eclipse Adoptium\jre-11.0.15.10-hotspot\bin;C:\Program Files (x86)\Eclipse Adoptium\jre-8.0.332.9-hotspot\bin;C:\Program Files\Python310\Scripts\;C:\Program Files\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\dotnet\;C:\Program Files\dotnet\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\FirefoxPWA\;c:\page;C:\Users\user\AppData\Roaming\nvm;C:\Program Files\nodejs;C:\Program Files\Streamlink\bin;C:\Program Files (x86)\Calibre2\;C:\Program Files\PuTTY\;C:\Program Files\Git\cmd;C:\Users\user\.cargo\bin;C:\Users\user\AppData\Local\Microsoft\WindowsApps;C:\Users\user\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user\ffmpeg\bin;C:\Users\user\AppData\Roaming\Python\Python310\Scripts;C:\Users\user\AppData\Roaming\nvm;C:\Program Files\nodejs
and when running cargo run on my test program:
fn main() {
println!("{}", std::env::var("PATH").unwrap());
let mut cmd = std::process::Command::new("cmd");
cmd.arg("/C");
cmd.arg("where");
cmd.arg("cargo");
cmd.status().unwrap();
}
those paths gets prepended: C:\Users\user\tester\target\debug\deps;C:\Users\user\tester\target\debug;C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib;C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin;
program outputs these line for where cargo:
C:\Users\user\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin\cargo.exe
C:\Users\user\.cargo\bin\cargo.exe
but only C:\Users\user\.cargo\bin\cargo.exe when not run via cargo.
Yea, the issue is https://github.com/rust-lang/rustup/issues/3036. I have posted a fix there for it.
The fix for here would be to use rustup run {toolchain} cargo {subcommand}. I have done it on each of my windows machines, and it works correctly.
Update on this: This can be fixed by setting the environment variable RUSTUP_WINDOWS_PATH_ADD_BIN=0. We hope to change the default option for that in rustup in the future.
This should now be fixed by default with rustup 1.27.1 released today.