Skip to content
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

Don't parse and reserialize toml in configure.py #112445

Open
jyn514 opened this issue Jun 9, 2023 · 5 comments
Open

Don't parse and reserialize toml in configure.py #112445

jyn514 opened this issue Jun 9, 2023 · 5 comments
Assignees
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented Jun 9, 2023

Currently, configure.py has a lot of code dedicated to parsing and serializing toml: https://github.com/rust-lang/rust/blob/6959dd0ee3e8c0c11d3ea54b258dfaf24f148a49/src/bootstrap/configure.py#L382-L509
90% of this is unnecessary: when we get --set rust.foo as an argument, we can write rust.foo = true directly to config.toml, without needing to parse the toml itself. That should make configure.py a lot simpler, and as a side effect it means the hack to append a profile will be valid toml again: #112281 (comment)

@rustbot label E-easy E-mentor

@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 9, 2023
@eval-exec
Copy link
Contributor

eval-exec commented Jun 10, 2023

we can write rust.foo = true directly to config.toml, without needing to parse the toml itself

Which toml file you mean in "without needing to parse the toml itself"? Is config.toml or config.example.toml?

@jyn514
Copy link
Member Author

jyn514 commented Jun 10, 2023

The toml in the --set string.

@eval-exec
Copy link
Contributor

we can write rust.foo = true directly to config.toml

I think your idea is suitable for "appending a new toml config to config.toml", but it's hard to replace an exist config in config.toml

@eval-exec
Copy link
Contributor

Oh, when ./config --set [balabala] is executated, we are creating a new config.toml file, not edit an existing file.

@rustbot rustbot added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Feb 15, 2025
@abylaw
Copy link

abylaw commented Feb 18, 2025

I'd love to work on this as a first issue @rustbot claim

@jyn514, if you think there's anything worth mentioned before I get started, please feel free to me know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

4 participants