-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Clarify Cargo.toml's LTO parse error message #97051
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon. Please see the contribution instructions for more information. |
Huh, I did run |
Thanks for the PR! Unfortunately this isn't correct. The values that |
The job Click to see the possible cause of the failure (guessed by this bot)
|
Okay, I will look into that. Seems pretty straightforward. The CI failure this time is from differing compile error outputs, which makes sense, to save you a click. |
r? @ehuss |
Either way, this PR specifically can be closed. |
add validation for string "true"/"false" in lto profile ### What does this PR try to resolve? Adds a special-cased error message for when `lto` is set to the _string_ `"true"`/`"false"` which is surprisingly (I was surprised anyway) not allowed and the error message is ambiguous. The new error message makes it clear what values are accepted. Fixes #10572 ### How should we test and review this PR? <!-- Demonstrate how you test this change and guide reviewers through your PR. With a smooth review process, a pull request usually gets reviewed quicker. If you don't know how to write and run your tests, please read the guide: https://doc.crates.io/contrib/tests --> Uh I've not actually tested yet that's the WIP part. But put ``` [profile.dev] lto="false" ``` in your TOML and run `cargo build`, check that you get the new error message and that it makes sense and is helpful. ### Additional information It's worth noting that as per rust-lang/rust#97051 this doesn't fix the _real_ problem here IMO which is that [rust's `opt_parse_bool` cli parsing](https://github.com/rust-lang/rust/blob/491f619f564a4ff9ae4cc837e27bb919d04c31be/compiler/rustc_session/src/options.rs#L456) doesn't accept true/false which certainly seems an ad-hoc historical choice to me on first glance but also it's a much bigger change to change those semantics than this error message.
Make the TOML LTO parse error message a little more specific, to be clear that it accepts both boolean and string valued expressions.
Only taken a month to edit a single string 😅
Closes rust-lang/cargo#10572