]> git.proxmox.com Git - cargo.git/commit - tests/testsuite/init/formats_source/out/src/lib.rs
Auto merge of #10676 - djmcgill:origin/master, r=weihanglo
authorbors <bors@rust-lang.org>
Sun, 5 Jun 2022 23:03:21 +0000 (23:03 +0000)
committerbors <bors@rust-lang.org>
Sun, 5 Jun 2022 23:03:21 +0000 (23:03 +0000)
commita9efb069c41dff873603f6e33816222fc293c54d
tree3dd5e36ad89b6547f87c8a68d84cbcb820be372d
parentcce487e13d102f066ae6b40d8225759f5fcb5d4a
parent0daf70d816b7d2adf576a3482866dc1a32170f44
Auto merge of #10676 - djmcgill:origin/master, r=weihanglo

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 https://github.com/rust-lang/cargo/issues/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 https://github.com/rust-lang/rust/pull/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.