Skip to content

Add explicit download methods to download module in bootstrap #144482

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

Merged

Conversation

Shourya742
Copy link
Contributor

This PR attempts to decouple the default initialization of the config object from parse_inner. It moves specific download methods, previously used during the initial config setup, into standalone functions outside the config implementation.

r? @Kobzol

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jul 26, 2025
@Kobzol
Copy link
Member

Kobzol commented Jul 26, 2025

Hi, thanks for taking a look at this? Just to clarify, did you separate just the Config download (and other related) methods that were needed for parse_inner, or everything? It seems to me that you moved a lot of methods to functions, but maybe the download functionality just needs all of that..

I took a look at the download functions, and they require mostly the same stuff. Rather than sending so many parameters to each function, could you create some DownloadContext or something like that, which will contain all the basic stuff needed by all downloads, and pass that to the download functions?

@Shourya742
Copy link
Contributor Author

Shourya742 commented Jul 26, 2025

Hi, thanks for taking a look at this? Just to clarify, did you separate just the Config download (and other related) methods that were needed for parse_inner, or everything? It seems to me that you moved a lot of methods to functions, but maybe the download functionality just needs all of that..

I took a look at the download functions, and they require mostly the same stuff. Rather than sending so many parameters to each function, could you create some DownloadContext or something like that, which will contain all the basic stuff needed by all downloads, and pass that to the download functions?

Yes, only the one's used during config parsing,(clippy and fmt as well, that I gonna revert, I thought they were used, but apparently not) I moved a couple of helpers methods as well. And ya they all required almost same set of arguments, I was nudging towards adding them. Just wanted concept acknowledgement from you, I will introduce a new structure for common fields.

@Shourya742 Shourya742 force-pushed the 2025-07-24-have-explicit-download-methods branch from d2df958 to 19dc195 Compare July 27, 2025 06:52
Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

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

Looks good. Let's use the functions in the config parsing, to get rid of the config method calls.

@rustbot
Copy link
Collaborator

rustbot commented Jul 28, 2025

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@Shourya742
Copy link
Contributor Author

Looks good. Let's use the functions in the config parsing, to get rid of the config method calls.

Did that here: db42d5b
We can't currently define a single DownloadContext at the top and reuse it across all explicit download methods. In this PR, I had to construct a DownloadContext explicitly before each download call because the ExecutionContext inside it requires a shared reference to the config, whereas other method calls in parse_inner require an exclusive reference to the config.

@Kobzol
Copy link
Member

Kobzol commented Jul 28, 2025

We will hopefully get rid of that config variable soon, so shouldn't be matter.

@Shourya742 Shourya742 requested a review from Kobzol July 28, 2025 15:18
@Kobzol
Copy link
Member

Kobzol commented Jul 28, 2025

  • config.patch_binaries_for_nix = patch_binaries_for_nix; is configured at line 889, but the first download ctx is created at 806.
  • config.llvm_assertions = ... is configured at 898.
  • config.bootstrap_cache_path is configured at 870.

The first and third thing should be easy to fix, not sure about the second one. Funnily enough, it looks like the code was already calling these download methods before even though the LLVM assertions field was not configured (?). In that case it should be probably fine. All the more reason to get rid of Default for Config...

@Shourya742
Copy link
Contributor Author

  • config.patch_binaries_for_nix = patch_binaries_for_nix; is configured at line 889, but the first download ctx is created at 806.
  • config.llvm_assertions = ... is configured at 898.
  • config.bootstrap_cache_path is configured at 870.

The first and third thing should be easy to fix, not sure about the second one. Funnily enough, it looks like the code was already calling these download methods before even though the LLVM assertions field was not configured (?). In that case it should be probably fine. All the more reason to get rid of Default for Config...

Yeah, I noticed that too. I was initially planning to leave them out of this PR since we were going to fix them in the next one anyway, but I ended up making the changes here: c071101 :)

@Kobzol
Copy link
Member

Kobzol commented Jul 29, 2025

Thanks, let's try!

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 29, 2025

📌 Commit c071101 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2025
Zalathar added a commit to Zalathar/rust that referenced this pull request Jul 29, 2025
…t-download-methods, r=Kobzol

Add explicit download methods to download module in bootstrap

This PR attempts to decouple the default initialization of the config object from parse_inner. It moves specific download methods, previously used during the initial config setup, into standalone functions outside the config implementation.

r? `@Kobzol`
bors added a commit that referenced this pull request Jul 29, 2025
Rollup of 14 pull requests

Successful merges:

 - #144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`)
 - #144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.)
 - #144407 (fix(debuginfo): disable overflow check for recursive non-enum types)
 - #144451 (fix: Reject upvar scrutinees for `loop_match`)
 - #144482 (Add explicit download methods to download module in bootstrap)
 - #144500 (thread name in stack overflow message)
 - #144511 (tidy: increase performance of auto extra checks feature)
 - #144586 (Update wasi-sdk to 27.0 in CI)
 - #144599 (bootstrap: enable tidy auto extra checks on tools profile)
 - #144600 (Ensure external paths passed via flags end up in rustdoc depinfo)
 - #144609 (feat: Right align line numbers)
 - #144623 (miri subtree update)
 - #144626 (cc dependencies: clarify comment)
 - #144627 (Add a test case for the issue #129882)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 29, 2025
Rollup of 13 pull requests

Successful merges:

 - #144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`)
 - #144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.)
 - #144407 (fix(debuginfo): disable overflow check for recursive non-enum types)
 - #144451 (fix: Reject upvar scrutinees for `loop_match`)
 - #144482 (Add explicit download methods to download module in bootstrap)
 - #144500 (thread name in stack overflow message)
 - #144511 (tidy: increase performance of auto extra checks feature)
 - #144599 (bootstrap: enable tidy auto extra checks on tools profile)
 - #144600 (Ensure external paths passed via flags end up in rustdoc depinfo)
 - #144609 (feat: Right align line numbers)
 - #144623 (miri subtree update)
 - #144626 (cc dependencies: clarify comment)
 - #144627 (Add a test case for the issue #129882)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 047304b into rust-lang:master Jul 29, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 29, 2025
rust-timer added a commit that referenced this pull request Jul 29, 2025
Rollup merge of #144482 - Shourya742:2025-07-24-have-explicit-download-methods, r=Kobzol

Add explicit download methods to download module in bootstrap

This PR attempts to decouple the default initialization of the config object from parse_inner. It moves specific download methods, previously used during the initial config setup, into standalone functions outside the config implementation.

r? ``@Kobzol``
@bors
Copy link
Collaborator

bors commented Jul 29, 2025

⌛ Testing commit c071101 with merge 7278554...

github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 1, 2025
Rollup of 13 pull requests

Successful merges:

 - rust-lang/rust#144022 (Implementation: `#[feature(sync_nonpoison)]`, `#[feature(nonpoison_mutex)]`)
 - rust-lang/rust#144167 (Document why `Range*<&T> as RangeBounds<T>` impls are not `T: ?Sized`, and give an alternative.)
 - rust-lang/rust#144407 (fix(debuginfo): disable overflow check for recursive non-enum types)
 - rust-lang/rust#144451 (fix: Reject upvar scrutinees for `loop_match`)
 - rust-lang/rust#144482 (Add explicit download methods to download module in bootstrap)
 - rust-lang/rust#144500 (thread name in stack overflow message)
 - rust-lang/rust#144511 (tidy: increase performance of auto extra checks feature)
 - rust-lang/rust#144599 (bootstrap: enable tidy auto extra checks on tools profile)
 - rust-lang/rust#144600 (Ensure external paths passed via flags end up in rustdoc depinfo)
 - rust-lang/rust#144609 (feat: Right align line numbers)
 - rust-lang/rust#144623 (miri subtree update)
 - rust-lang/rust#144626 (cc dependencies: clarify comment)
 - rust-lang/rust#144627 (Add a test case for the issue rust-lang/rust#129882)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants