I have some directories where I've set overrides and some directories where I haven't set overrides, and I don't remember which directories have overrides or not.
I'll be working on a project and want to change the Rust version I'm currently using, so I'll run:
$ rustup default beta
Which outputs:
info: using existing install for 'beta-x86_64-apple-darwin'
info: default toolchain set to 'beta-x86_64-apple-darwin'
beta-x86_64-apple-darwin unchanged - rustc 1.33.0-beta.4 (635817b9d 2019-01-24)
So I say, "cool, I'm using beta now!" and go about cargo building, etc.
In a directory without an override, I am indeed using beta.
In a directory with an override, I get the same output, but I am not using beta (necessarily), I'm using the override. So I cargo build thinking I'm on beta, but I'm not.
If I'm in a directory without an override, I'd like the current behavior of rustup default to stay the same.
If I'm in a directory with an override, I'd like the output of rustup default to remind me that I have an override and that I'm not using the default that I just changed. Something like:
$ rustup default beta
info: using existing install for 'beta-x86_64-apple-darwin'
info: default toolchain set to 'beta-x86_64-apple-darwin'
beta-x86_64-apple-darwin unchanged - rustc 1.33.0-beta.4 (635817b9d 2019-01-24)
(currently using 1.24.1-x86_64-apple-darwin, directory override for '/Users/carolnichols/rust/carol-test')
If this is a personal problem of mine, I can script my way around it, but I wanted to file this and see what others thought and then potentially submit a PR if other folks have this problem too.
Note we're about to make rustup default (without any arguments) more informative: https://github.com/rust-lang/rustup.rs/pull/1633, though I don't know how that behaves with overrides present (cc @lazorgator).
Advising the user that even after changing the default a directory override is present sounds like a good idea to me. I think it should do it for all methods that have precedence on the default, as described in https://github.com/rust-lang/rustup.rs/blob/1.16.0/README.md#override-precedence. So if there is a rust-toolchain file or a RUSTUP_TOOLCHAIN env var.
@dwijnand At present, the rustup default only returns the global default toolchain. Maybe it should detect if there is an override and output that along with the default? Something like:
canis@latrans:~/rustup.rs$ rustup default
Default toolchain: stable-x86_64-unknown-linux-gnu
Current override: nightly-x86_64-unknown-linux-gnu
@carols10cents Opened a PR. I liked your idea better, so the change will result in some lines of logging being output to notify you of an override being set, and why it is set.
Awesome, thank you @lazorgator !!!!
Most helpful comment
@dwijnand At present, the
rustup defaultonly returns the global default toolchain. Maybe it should detect if there is an override and output that along with the default? Something like: