Skip to content
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

In a directory with an override, display override after succesful default change #1648

Closed
carols10cents opened this issue Feb 10, 2019 · 4 comments

Comments

@carols10cents
Copy link
Member

The problem I am trying to solve

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.

The solution I'd like

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.

@dwijnand
Copy link
Member

dwijnand commented Feb 11, 2019

Note we're about to make rustup default (without any arguments) more informative: #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.

@das-sein
Copy link
Contributor

das-sein commented Feb 11, 2019

@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

@das-sein
Copy link
Contributor

@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.

@carols10cents
Copy link
Member Author

Awesome, thank you @lazorgator !!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants