Skip to content

Conversation

@rami3l
Copy link
Member

@rami3l rami3l commented Oct 24, 2025

No description provided.

@rami3l rami3l requested a review from djc October 24, 2025 02:51
@rami3l rami3l force-pushed the rami3l-patch-1 branch 4 times, most recently from a098dc9 to fd92da2 Compare October 24, 2025 03:55
@rami3l rami3l changed the title fix(cli/rustup-mode): fix missing newline in rustup check refactor(cli/rustup-mode): merge self-update checking logic in rustup update Oct 24, 2025
}

/// Whether the self-update functionality is enabled during compilation.
pub(crate) const CFG_SELF_UPDATE: bool = !cfg!(feature = "no-self-update");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is redoing something that I undid only recently. I don't see much value in it -- it just obscures the original meaning and saves a few characters.

Copy link
Member Author

@rami3l rami3l Oct 25, 2025

Choose a reason for hiding this comment

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

@djc I still think the double negation here in !cfg!("no-*") is a bit confusing, but you can totally have different opinions.

info!("self-update is disabled for this build of rustup");
info!("any updates to rustup will need to be fetched with your system package manager")
match self_update_mode {
_ if !CFG_SELF_UPDATE => {
Copy link
Contributor

Choose a reason for hiding this comment

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

If this is the reason, I think you can cfg!() instead of an attribute.

Copy link
Member Author

@rami3l rami3l Oct 25, 2025

Choose a reason for hiding this comment

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

Sorry for not having explained the full background until now, but when looking at #4565 I realized that the self-update cleanup code is very curiously written in two parts, so I want to merge them together first to make the overall logic clearer.

However, since this change is not directly related to #4565, I planned on making two separate PRs...

Copy link
Member Author

@rami3l rami3l Oct 25, 2025

Choose a reason for hiding this comment

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

@djc I'm not entirely sure about your proposals, but maybe this could be simplified to just the following?

    if cfg!(feature = "no-self-update") {
        info!("self-update is disabled for this build of rustup");
        info!("any updates to rustup will need to be fetched with your system package manager")
    } else if self_update_mode == SelfUpdateMode::CheckOnly {
        check_rustup_update(&dl_cfg).await?;
    }

... the idea is that this block covers all the cases where self_update() is not executed, and when I add the extra if self_update block in a second PR, it'll be clearer when each case is handled.

Or you might have different opinions regarding the fix?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've made #4566 to hopefully make my original intentions clearer.

@rami3l
Copy link
Member Author

rami3l commented Oct 26, 2025

Closing in favor of #4566.

@rami3l rami3l closed this Oct 26, 2025
@rami3l rami3l deleted the rami3l-patch-1 branch October 26, 2025 17:40
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.

2 participants