Issues with changing toolchain with rustup

UPDATE: i fixed by accident. this is what i did, i opened a terminal outside the workspace and uninstalled and reinstalled both the nightly and stable versions. but then cargo stopped working, like the command wasn't installed, but rustc worked and gave the correct version when i switched toolchains. then i exited and reopened the terminal and cargo was working.


I was using the nightly (1.71.0) version for cargo. but then to test something out i switched the default toolchain to stable. I've since changed the default toolchain back to nightly, but cargo --version is still stable 1.69.0

Even if I have a rust-toolchain.toml in the workspace root, cargo is still 1.69

I've tried reinstalling the toolchains, doing rustup update, checked the defaults and overrides, and I couldn't figure it out

I'm having to compile my project with rustup run nightly cargo build

What am I doing wrong?

The filename should be rust-toolchain (without .toml).

Sadly that's not it. from the rustup book

In these cases the toolchain can be named in the project's directory in a file called rust-toolchain.toml or rust-toolchain.

And the file is from a repo I'm working on, not mine, so I assume it's working for other people

Check environment variable RUSTUP_TOOLCHAIN then?

I’ll mark this topic as solved, so it’s more clear :slight_smile: – cannot mark the original post as a solution, so this answer will have to do..

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.