Skip to content

Deduplicate codegen backends in bootstrap config#158516

Open
kn1g78 wants to merge 4 commits into
rust-lang:mainfrom
kn1g78:codegen-backend-dedupe
Open

Deduplicate codegen backends in bootstrap config#158516
kn1g78 wants to merge 4 commits into
rust-lang:mainfrom
kn1g78:codegen-backend-dedupe

Conversation

@kn1g78

@kn1g78 kn1g78 commented Jun 28, 2026

Copy link
Copy Markdown

Deduplicate rust.codegen-backends and target.<triple>.codegen-backends during bootstrap config parsing while preserving first occurrence order.

This avoids carrying redundant backend entries into later bootstrap planning.

test:

$env:CARGO_NET_OFFLINE='false'; $env:CARGO_TARGET_DIR='target-codex-test'; $cargo = Join-Path $env:USERPROFILE '.cargo\bin\cargo.exe'; & $cargo test --manifest-path src/bootstrap/Cargo.toml deduplicates_codegen_backends

result:

running 1 test
test core::config::tests::deduplicates_codegen_backends ... ok

test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 255 filtered out; finished in 0.00s

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 28, 2026
@rust-log-analyzer

This comment has been minimized.

@kn1g78 kn1g78 marked this pull request as ready for review June 28, 2026 10:48
@rustbot

rustbot commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

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

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 28, 2026
@rustbot

rustbot commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @jieyouxu (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: bootstrap
  • bootstrap expanded to 6 candidates
  • Random selection from Mark-Simulacrum, clubby789, jieyouxu

@jieyouxu jieyouxu left a comment

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.

I don't understand what you mean by

This avoids carrying redundant backend entries into later bootstrap planning.

Can you elaborate? Also the testing section in PR description is surprising, why does that go through cargo test, and not... bootstrap?

@rustbot author

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 28, 2026
@rustbot

rustbot commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@kn1g78

kn1g78 commented Jun 28, 2026

Copy link
Copy Markdown
Author

Thanks, that sentence was unclear. I meant that duplicate entries in codegen-backends can currently remain in the parsed config, so enabled_codegen_backends may return the same backend more than once. This patch normalizes the parsed list so later bootstrap code sees each backend once, while preserving first occurrence order.

You're right about the testing section. I reran it through bootstrap:

python x.py test bootstrap --test-args deduplicates_codegen_backends
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 255 filtered out
Build completed successfully in 0:06:30

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 28, 2026
@Kobzol

Kobzol commented Jun 28, 2026

Copy link
Copy Markdown
Member

We treat this array as a set anyway, except for caring which of the backends was specified as the first one. If anything, specifying the same backend multiple times should be an error, not a silent skip.

@jieyouxu jieyouxu left a comment

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.

Yeah, let's instead reject trying to specify the same cg backend multiple times instead

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 30, 2026
@rust-log-analyzer

This comment has been minimized.

@kn1g78

kn1g78 commented Jun 30, 2026

Copy link
Copy Markdown
Author

i finished it, thank u @rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants