-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
RUSTUP_TOOLCHAIN override prevents rustup overrides from being respected #16932
Comments
Actually it looks like it's being run in the correct directory, BUT the toolchain is being overidden:
|
I've investigated further, the root issue can be seen here: "rust-analyzer.linkedProjects": [
"./crates/bevy_api_gen/Cargo.toml",
"Cargo.toml"
],
"rust-analyzer.check.invocationStrategy": "per_workspace",
"rust-analyzer.check.invocationLocation": "workspace",
"rust-analyzer.check.overrideCommand": [
"/home/makspll/git/bevy_mod_scripting/check.sh"
] check.sh: echo "invoked '$0' at '$PWD' with args: '$@', using toolchain '$(rustup show active-toolchain)'" >> /home/makspll/git/bevy_mod_scripting/log
cargo clippy --message-format=json log:
You can see the rustup toolchain overrides are being overridden via the RUSTUP_TOOLCHAIN env variable, I am not sure why it's being set here |
See #16563, this is intentional. We want to make sure that we invoke the correct binaries for a given discovered sysroot of a workspace. |
As seen here:
https://github.com/rust-lang/rust-analyzer/blob/e265e3d5189513c42d037999d41a696369af9388/crates/flycheck/src/lib.rs#L408C1-L408C80
With the given settings.json:
I believe cargo clippy will be run from the root instead of the workspace location, meaning that rustup overrides are not respected, and hence checking fails for projects using different toolchains in each linked project.
Is there any work around?
The text was updated successfully, but these errors were encountered: