Skip to content

Allow rustup component add to install multiple components in one update#4790

Open
Inconnu08 wants to merge 1 commit intorust-lang:mainfrom
Inconnu08:component-add-multi-install
Open

Allow rustup component add to install multiple components in one update#4790
Inconnu08 wants to merge 1 commit intorust-lang:mainfrom
Inconnu08:component-add-multi-install

Conversation

@Inconnu08
Copy link
Copy Markdown

This updates rustup component add to handle multiple components in a
single operation instead of processing them sequentially.

Closes #4787
Related to #731

Copy link
Copy Markdown
Contributor

@FranciscoTGouveia FranciscoTGouveia left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

Small note: please avoid referencing issues (or PRs) directly in commit messages as this can generate unwanted notification spam. This is mentioned in the antepenultimate paragraph of the rustc-dev-guide.

View changes since this review

Copy link
Copy Markdown
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

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

Mostly LGTM, some style nits. Thanks!

View changes since this review

);
distributable.add_component(new_component).await?;
}
let new_components = targets
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: suggest to avoid binding this, and just passing it directly to add_components().

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

... and in this case you don't need to specify the Vec<_> type, I think,

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Ah, yes, thank you. I inlined the collection and removed the explicit Vec<_> type.

.get(&self.desc.target)
.expect("installed manifest should have a known target");

if !targ_pkg.components.contains(&component) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Kind of pre-existing, but please invert this condition to continue early, reducing rightward drift.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point, I refactored this section to reduce nesting and improve readability

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I also hoisted the manifest target lookup out of the loop since it doesn’t depend on the individual component...

@Inconnu08 Inconnu08 force-pushed the component-add-multi-install branch 2 times, most recently from 647d3af to 20f047f Compare April 1, 2026 04:31
@Inconnu08 Inconnu08 force-pushed the component-add-multi-install branch from 20f047f to 3c7796a Compare April 1, 2026 05: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.

rustup component add should install multiple components at once

4 participants