-
Notifications
You must be signed in to change notification settings - Fork 977
feat(config): warn user if auto-install is enabled #4454
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
base: master
Are you sure you want to change the base?
Conversation
pub(crate) async fn from_local( | ||
name: LocalToolchainName, | ||
install_if_missing: bool, | ||
install_if_missing: impl Fn() -> anyhow::Result<bool>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is made so that the self.should_auto_install()
call is postponed to L64, and that the false positive in L60 can be suppressed.
b1d9725
to
8d25c01
Compare
39db6e4
to
7ab47c5
Compare
src/test/clitools.rs
Outdated
// Disable auto installation of active toolchain unless explicitly requested | ||
cmd.env("RUSTUP_AUTO_INSTALL", "0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this. IMO we should keep the defaults in the tests the same way they are when running real-world rustup
, otherwise things get confusing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djc FYI this line should be a proof, not a requirement: the changes in this commit modulo this line will continue to work even if RUSTUP_AUTO_INSTALL
is set to 1
or not set at all. How about unsetting it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsetting it seems okay to me, as that should make it similar to the default behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djc Hmmm technically those fixes did work but now we are creating a lot of noises in the snapshot tests 🤔
I will try to find a way out of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djc How about introducing another env var to remove this warning without disabling auto install?
Update: Okay, I think this means that the evaluation of self.should_auto_install()
is not lazy enough. I'll try to fix that first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had another look, it turns out that Cfg::local_toolchain()
calls .maybe_ensure_active_toolchain(None)
which is the expected behavior (the old one, and the default for the moment), even if the toolchain is generally assumed to exist, and changing this might cause unexpected breakage.
7ab47c5
to
2f50a0a
Compare
2f50a0a
to
e22e682
Compare
This commit ensures that every test case relying on the `RUSTUP_AUTO_INSTALL` config option is explicitly setting it, and every other test case will pass regardless of its value.
e22e682
to
2e5dd94
Compare
Closes #4445.