Skip to content

feat(cli/rustup-mode): warn about auto-installation in some subcommands#4895

Open
rami3l wants to merge 3 commits into
rust-lang:release/1.29from
rami3l:feat/backport-auto-install-rustup-warn
Open

feat(cli/rustup-mode): warn about auto-installation in some subcommands#4895
rami3l wants to merge 3 commits into
rust-lang:release/1.29from
rami3l:feat/backport-auto-install-rustup-warn

Conversation

@rami3l
Copy link
Copy Markdown
Member

@rami3l rami3l commented Jun 5, 2026

Adapted from c037408 (#4840); closes #4894.

@rami3l rami3l modified the milestone: 1.29.1 Jun 5, 2026
@rami3l rami3l added the backport This is an issue which should be backported to the next patch release, or it is a backporting PR. label Jun 5, 2026
@rami3l
Copy link
Copy Markdown
Member Author

rami3l commented Jun 5, 2026

Hmmm the blast radius is too large.

Lemme think: maybe we should just print the warning as an additional step for warn_auto_install()?

@rami3l rami3l force-pushed the feat/backport-auto-install-rustup-warn branch 3 times, most recently from 41ff1f3 to 191ea78 Compare June 5, 2026 17:47
@rami3l rami3l changed the title feat: warn about auto-installation in some rustup subcommands feat(cli/rustup-mode): warn about auto-installation in some subcommands Jun 5, 2026
@rami3l rami3l force-pushed the feat/backport-auto-install-rustup-warn branch from 191ea78 to 7375543 Compare June 5, 2026 18:28
@rami3l rami3l force-pushed the feat/backport-auto-install-rustup-warn branch from 7375543 to 5f10e42 Compare June 5, 2026 18:44
@rami3l rami3l marked this pull request as ready for review June 5, 2026 19:13
@rami3l rami3l requested a review from djc June 5, 2026 19:13
Comment thread src/config.rs
}

// NOTE: Special behavior for rustup v1.29
warn!("auto-installation of the active toolchain is enabled when running `rustup`");
Copy link
Copy Markdown
Contributor

@djc djc Jun 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird to have both the warning above and this warning shown at the same time?

View changes since the review

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djc Good catch!

How about showing the existing warning only when the deprecation notice is not shown?

Comment thread src/config.rs
}

pub(crate) fn should_auto_install(&self) -> Result<bool> {
if !self.allow_auto_install {
Copy link
Copy Markdown
Contributor

@djc djc Jun 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this trying to achieve?

View changes since the review

Copy link
Copy Markdown
Member Author

@rami3l rami3l Jun 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@djc Thanks for asking!

In c037408 (#4840) which is what this PR is based on, self.allow_auto_install is used to reject auto install from happening which is achieved by passing false instead of true for some rustup subcommands which will cause this function to reject auto installation right away.

However, since it is decided that in 1.29 we should only warn instead of rejecting directly, this commit replaces it with a warning.

It should be noted that the warning should have existed in this function but since this will cause too many false positives (we should only show it when an auto-installation is actually triggered, not whenever we are in an auto-install deprecated subcommand), it is moved to another module.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't hesitate to suggest any changes if you think that will make your review easier.

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

Labels

backport This is an issue which should be backported to the next patch release, or it is a backporting PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants