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

Cargo does not handle +toolchain directives. #1494

Closed
andriyDev opened this issue Mar 17, 2024 · 8 comments · Fixed by #1518 or #1536
Closed

Cargo does not handle +toolchain directives. #1494

andriyDev opened this issue Mar 17, 2024 · 8 comments · Fixed by #1518 or #1536
Assignees
Labels

Comments

@andriyDev
Copy link
Contributor

I am on Windows 10, using Rust 1.76, default toolchain set to stable-x86_64-pc-windows-msvc. I ran cargo new --lib code-cov-example, cd'ed into it, and ran cargo tarpaulin and got the following message:

2024-03-17T02:39:04.649653Z  INFO cargo_tarpaulin::config: Creating config
2024-03-17T02:39:04.792126Z  INFO cargo_tarpaulin: Running Tarpaulin
2024-03-17T02:39:04.792368Z  INFO cargo_tarpaulin: Building project
2024-03-17T02:39:04.792590Z  INFO cargo_tarpaulin::cargo: Cleaning project
error: no such command: `+stable-x86_64-pc-windows-msvc`

        Cargo does not handle `+toolchain` directives.
        Did you mean to invoke `cargo` through `rustup` instead?
2024-03-17T02:39:04.894216Z ERROR cargo_tarpaulin: Cargo failed to run! Error: cargo run failed
Error: "Cargo failed to run! Error: cargo run failed"

I'm not really sure how to debug this. I also just installed tarpaulin using cargo install cargo-tarpaulin like normal.

@xd009642
Copy link
Owner

This should only happen if you have the RUSTUP_TOOLCHAIN env var set. Which would imply that you're using rustup and + directives should work.

Just wondering do you handle your rust install via rustup? And why is that environment variable set? Just trying to understand a bit more because it will have been added to fix another users issue so I don't want to just willy-nilly remove the env var check

@andriyDev
Copy link
Contributor Author

Looking at my Windows environment variables, I don't have RUSTUP_TOOLCHAIN set! I am using rustup for my Rust install. I even tried using Powershell to see if it would do the trick and no luck.

@xd009642
Copy link
Owner

Sorry for the delay, I have pushed a branch with a potential fix, if you could try it out and let me know if it solves it - otherwise I'll look to different methods. The branch is fix/broken-toolchain-directives

@xd009642 xd009642 linked a pull request Apr 27, 2024 that will close this issue
@xd009642
Copy link
Owner

Doing too many PRs at once and merged this one. It's a change I likely would have merged anyway... But yeah it's in develop now!

@xd009642 xd009642 reopened this Apr 27, 2024
@xd009642 xd009642 added the bug label Apr 27, 2024
@xd009642
Copy link
Owner

xd009642 commented May 2, 2024

Okay this is released, I'll close the issue but if it still persists feel free to reopen

@xd009642 xd009642 closed this as completed May 2, 2024
@andriyDev
Copy link
Contributor Author

Ah dang, I lost track of this, sorry! I just upgraded to v0.29.0. Looks like the issue is still occuring :/

@xd009642 I don't think I'm able to reopen this issue.

@andriyDev
Copy link
Contributor Author

Ok I decided to clone the repo and tinker with it. I just printed all my environment variables and RUSTUP_TOOLCHAIN is there clear as day. However running env in Git bash, or Get-ChildItem env: in Powershell does not include this variable. Very odd!

@andriyDev
Copy link
Contributor Author

I believe I know what the issue is: I have rustup installed to a non-default directory E:\\Programs\RustUp. tarpaulin includes the +toolchain directive if .rustup is not in the path. Instead, we should be using the RUSTUP_HOME environment variable if it is present.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants