Skip to content

Conversation

rami3l
Copy link
Member

@rami3l rami3l commented Aug 24, 2025

Closes #4445.

pub(crate) async fn from_local(
name: LocalToolchainName,
install_if_missing: bool,
install_if_missing: impl Fn() -> anyhow::Result<bool>,
Copy link
Member Author

@rami3l rami3l Aug 24, 2025

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.

@rami3l rami3l force-pushed the feat/warn-auto-install branch 7 times, most recently from b1d9725 to 8d25c01 Compare August 31, 2025 15:34
@rami3l rami3l marked this pull request as ready for review August 31, 2025 15:34
@rami3l rami3l marked this pull request as draft August 31, 2025 15:42
@rami3l rami3l force-pushed the feat/warn-auto-install branch 2 times, most recently from 39db6e4 to 7ab47c5 Compare September 1, 2025 12:05
@rami3l rami3l requested review from djc and ChrisDenton and removed request for djc September 1, 2025 12:07
@rami3l rami3l marked this pull request as ready for review September 1, 2025 12:07
Comment on lines 283 to 284
// Disable auto installation of active toolchain unless explicitly requested
cmd.env("RUSTUP_AUTO_INSTALL", "0");
Copy link
Contributor

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.

Copy link
Member Author

@rami3l rami3l Sep 22, 2025

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?

Copy link
Contributor

@djc djc Sep 22, 2025

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.

Copy link
Member Author

@rami3l rami3l Sep 22, 2025

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.

Copy link
Member Author

@rami3l rami3l Sep 22, 2025

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.

Copy link
Member Author

@rami3l rami3l Sep 22, 2025

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.

@rami3l rami3l force-pushed the feat/warn-auto-install branch from 7ab47c5 to 2f50a0a Compare September 22, 2025 08:49
@rami3l rami3l force-pushed the feat/warn-auto-install branch from 2f50a0a to e22e682 Compare September 22, 2025 08:51
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.
@rami3l rami3l force-pushed the feat/warn-auto-install branch from e22e682 to 2e5dd94 Compare September 22, 2025 08:55
@rami3l rami3l requested a review from djc September 22, 2025 08:57
@rami3l rami3l marked this pull request as draft September 22, 2025 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Show that a toolchain download is due to rust-toolchain.toml
2 participants