-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Add sample defaults for config.toml #76628
Conversation
4f0e619
to
aa6c033
Compare
aa6c033
to
ed75e11
Compare
This comment has been minimized.
This comment has been minimized.
f6b512c
to
dfcbdf4
Compare
Hmm, I think I'll change |
I am feeling like we should at least split the actual inclusion of defaults into a separate PR, and perhaps one PR per default file. It would help me at least if they were documented in those files (at least with links) as to rationale why we think these are the right defaults. That would also likely help people figure out which one to use. I am fine with that documentation being on rustc-dev-guide, but I personally think it would be better suited to being in tree. I don't feel strongly on that point though. I am not sure how I feel about the merge crate dependency or the effect that has here. It seems a bit worrisome that we're going to end up ignoring the merged-in parts in bootstrap.py with the current approach. Do you know if simple concatenation of the various file contents will perhaps work well enough for us? |
Well, the
+1, I'll add that.
Hmm, I'm ok with this but I'm not sure how to decide on defaults in the first place ... maybe I could post a thread on Zulip and solicit opinions? Ideally these would be options people actually use, so me picking random things doesn't help as much as hearing what people are using. Fortunately these defaults don't impact workflows unless you opt-in to the changes, so we can always change things after the fact. |
This didn't work :(
|
e58f686
to
09c37a3
Compare
Hm. I wonder if https://docs.rs/toml/0.5.6/toml/de/struct.Deserializer.html#method.set_allow_duplicate_after_longer_table would help there, though that could get removed at some point. The reason I'd prefer not to use something like merge is because it seems quite error prone to use, or at least, there are interactions that I wouldn't want to leave up to proc macro I think (e.g., The precise error we're seeing is because That is, is this an error? If so then there's probably nothing we can do, but if not perhaps there's room for us to modify things into a flat namespace and go for concatenation... debug = true
debug = false |
Unfortunately that's an error:
Hmm, I'm not sure how relevant that is ... this is merging the parsed structs, not
I'm not opposed to a flat namespace ... maybe we could use |
Oh - one issue with doing simple concatenation is that it will give errors if there's a setting in the defaults that you override yourself:
Maybe that's a good thing, so you know if the defaults conflict? I'd prefer it to give precedence to |
It is not backwards compatible :(
|
Would you be opposed to using |
I think tests would be unhelpful. Let's use merge for now, and see where that gets us -- I worry that it will not behave like we want, but perhaps that worry is unfounded. If we run into trouble we can explore alternatives down the line. If you can update the PR description, that would be great, and then r=me. I am not sure that the defaults here are 100% what we want, but we can explore modifying them in future PRs, perhaps before recommending this in rustc-dev-guide. It may also make sense to stick headers on the "include" to suggest filing an issue if you ended up adjusting any additional settings or changing defaults. |
I updated the PR description and pushed some changes fixing bugs, it turns out you were right the derive didn't behave as expected. I emailed the maintainer asking them to make the behavior in c5925ba the default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also squash the commits -- generally speaking on PRs that modify ~100 lines or less I don't think not squashing commits as you go is helpful.
- Allow including defaults in `src/bootstrap/defaults` using `profile = "..."` - Add default config files - Combine config files using the merge dependency. - Add comments to default config files - Add a README asking to open an issue if the defaults are bad - Give a loud error if trying to merge `.target`, since it's not currently supported - Use an exhaustive match - Use `<none>` in config.toml.example to avoid confusion - Fix bugs in `Merge` derives Previously, it would completely ignore the profile defaults if there were any settings in `config.toml`. I sent an email to the `merge` maintainer asking them to make the behavior in this commit the default. This introduces a new dependency on `merge` that hasn't yet been vetted. I want to improve the output when `include = "x"` isn't found: ``` thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy Build completed unsuccessfully in 0:00:00 ``` However that seems like it could be fixed in a follow-up.
914efe4
to
c9c8fb8
Compare
It looks like the PR description still talks about a poor error on non-existent includes, but I think the code handles that better now? |
It still has a panic:
It's not the worst thing in the world, but it would be nice to at least print the file it didn't find. |
Ah, okay, we handle the parsing error nicely but not the non-existence. That's okay for now, it doesn't appear to be a regression. I am happy with a future patch to merge target configs, especially because I'm not even sure we want to: it's rather unclear that doing so will benefit us because having target-specific defaults seems potentially confusing. (That said, implicitly enabling the download-ci-llvm option on Linux might be a good idea). |
@bors r+ |
📌 Commit c9c8fb8 has been approved by |
…-Simulacrum Add sample defaults for config.toml - Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`. - Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set. - Combine config files using the `merge` dependency. This introduces a new dependency on `merge` that hasn't yet been vetted. I want to improve the output when `include = "x"` isn't found: ``` thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy Build completed unsuccessfully in 0:00:00 ``` However that seems like it could be fixed in a follow-up. Closes rust-lang#76619
…-Simulacrum Add sample defaults for config.toml - Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`. - Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set. - Combine config files using the `merge` dependency. This introduces a new dependency on `merge` that hasn't yet been vetted. I want to improve the output when `include = "x"` isn't found: ``` thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy Build completed unsuccessfully in 0:00:00 ``` However that seems like it could be fixed in a follow-up. Closes rust-lang#76619
…-Simulacrum Add sample defaults for config.toml - Allow including defaults in `src/bootstrap/defaults` using `profile = "..."`. - Add default config files, with a README noting they're experimental and asking you to open an issue if you run into trouble. The config files have comments explaining why the defaults are set. - Combine config files using the `merge` dependency. This introduces a new dependency on `merge` that hasn't yet been vetted. I want to improve the output when `include = "x"` isn't found: ``` thread 'main' panicked at 'fs::read_to_string(&file) failed with No such file or directory (os error 2) ("configuration file did not exist")', src/bootstrap/config.rs:522:28 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace failed to run: /home/joshua/rustc/build/bootstrap/debug/bootstrap test tidy Build completed unsuccessfully in 0:00:00 ``` However that seems like it could be fixed in a follow-up. Closes rust-lang#76619
Rollup of 13 pull requests Successful merges: - rust-lang#76135 (Stabilize some Option methods as const) - rust-lang#76628 (Add sample defaults for config.toml ) - rust-lang#76846 (Avoiding unnecesary allocations at rustc_errors) - rust-lang#76867 (Use intra-doc links in core/src/iter when possible) - rust-lang#76868 (Finish moving to intra doc links for std::sync) - rust-lang#76872 (Remove DeclareMethods) - rust-lang#76936 (Add non-`unsafe` `.get_mut()` for `Unsafecell`) - rust-lang#76958 (Replace manual as_nanos and as_secs_f64 reimplementations) - rust-lang#76959 (Replace write_fmt with write!) - rust-lang#76961 (Add test for issue rust-lang#34634) - rust-lang#76962 (Use const_cstr macro in consts.rs) - rust-lang#76963 (Remove unused static_assert macro) - rust-lang#77000 (update Miri) Failed merges: r? `@ghost`
src/bootstrap/defaults
usingprofile = "..."
.merge
dependency.This introduces a new dependency on
merge
that hasn't yet been vetted.I want to improve the output when
include = "x"
isn't found:However that seems like it could be fixed in a follow-up.
Closes #76619