rust-lang / rust-lang/rustup

`rustup default nightly` won't update the %PATH% if existing old install is present

Open
#965 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Hey guys, I have just solved an issue that's been plaguing me for a long time. It's a trivial one when one takes time to look into it, but it could be a gotcha that affects other people and makes them shy away from playing with Rust on Windows, which'd be extremely unfortunate.

I have had a super old install of Rust, pre-rustup lying around in my system. This caused issues, specifically, I wanted to try out Rocket so I went rustup install nightly-2017-02-25 (today's latest nightly won't work due to rust-lang/rust#40106) and then rustup default nightly-2017-02-25. However, running rustc --version gave me this: rustc 1.11.0 (9b21dcd6a 2016-08-15)

The reason for that is that where rustc returns C:\Program Files\Rust stable GNU 1.11\bin\rustc.exe and only then as a second value what it should, based on How rustup works: %USERPROFILE%/.cargo/bin/rustc.exe. I have simply deleted the first directory and that solve the issue of the old version of the compiler being picked up.

I think rustup should have a heuristic built in that after installing or defaulting a new version runs rustc --version and cargo --version and check that the returned versions match what they should. If there is a mismatch, it should print out where rustc and where cargo (which on Unix) and help the user figure out what was wrong, maybe even give them a tip on how to change %PATH% using command line - many Windows developers are not very familiar with command line, but that shouldn't prevent them from trying out Rust. I would rather rustup did not change %PATH% automatically, but it should tell the user where it detects and error and help them understand how to fix it.

What do you guys think? Practical? I don't know what's in the rustup manifests, but I am sure there is a way to surface the proper rustc and cargo versions so this check could be made. Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the rustup install and default flows, the toolchain manifests, and the documented rustup workflow. Compare the selected rustc and cargo versions with the results of where on Windows or which on Unix; done means a mismatch is detected and the user receives actionable diagnostics without rustup silently changing PATH.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.