-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Clippy can run the wrong rustc, leading to "incompatible version of rustc" errors #9560
Comments
I have encountered this problem as well. |
I'm running into this as well. I have another thing installed via homebrew that has rust as a dependency, and so I can't uninstall the system rust without first uninstalling the other thing (which I don't want to uninstall). Is there a workaround for this? Like a way to just configure clippy to use a specific rustc? |
Same here. Would love an update to this problem. |
Any workaround? |
If your system is like mine, the workaround is |
I had this issue, it finally worked when I deleted rustc directly (by sudo rm /usr/bin/rustc) (or wherever your rustc lies). Then cargo clean and cargo clippy in my project directory. rustc version 1.66.1 |
Thank you for this thread. Clippy hasn't worked for weeks and it turns out that rust was somehow installed via homebrew. Uninstalling it fixed my problem. |
I've also run into this and tried to debug the problem. I believe that this actually stems from a different Line 129 in a7335cb
Running the following command on my local machine probably explains why this is happening: find $(echo $PATH | tr ':' '\n') -type f,l -name "cargo" Output:
=> This issue probably references the same problem: Homebrew/brew#13281: As Homebrew/brew#13281 (comment) suggests, setting As I do not own a Mac, I can't verify whether this is the reason for the error in the OP. |
Nice debugging, @simonhammes. It looks like this repo uses |
This issue is about to come up a lot more frequent I fear. As rust is now used in the kernel 🥳 Use Now the question is whether this goes wrong in clippy or cargo... |
Under Debian (probably also Ubuntu & co.): # Removes the rustc installed though apt, leaving only the one installed though rustup (hopefully)
sudo apt-get remove rustc
# Removes all compile artifacts, including the ones compiled with the apt-installed rustc
cargo clean
# This should now work
cargo clippy |
I had this issue on Windows too because I initially installed the standalone version before using the Inspired by @simonhammes and this question on Rust users forum I looked up for conflicting installs from powershell:
Ouput: On the other hand:
Output: I wasn't sure how to uninstall standalone version so I just updated the |
Summary
I had several versions of Rust installed (via rustup) and was surprised that Clippy would sometimes give errors like this:
1.64.0 was in fact the version I wanted to be using.
The surprise came when I did
rustup toolchain remove 1.63.0
, thencargo clean && cargo clippy
, and still got the same error!It turns out I had yet another copy of Rust 1.63.0 installed, via Homebrew, as
/usr/local/bin/rustc
.I think I must have done
brew install rust-analyzer
at some point and that brought in therust
package.Obviously that was bad and I just removed it. But this means
cargo clippy
sometimes results in two different rustc executables being used. I think that must be a bug.Reproducer
Possible steps to reproduce, using code in https://github.com/jorendorff/incompavers:
Have Homebrew and rustup installed
Run these commands:
Expected behavior: Clippy should lint the crate.
Actual behavior: Clippy produced the errors below.
Version
Additional Labels
No response
The text was updated successfully, but these errors were encountered: