Print build profile options

Hello!

There's currently some ongoing discussion about the build flags Arch Linux wants to use, I want to compare this with the current upstream default options/profile but it seems there's no way to do so.

There's a page in the documentation, but with a risk of this page being outdated, I think there's value in having a way to ask the compiler to print the profile it would select. This command would possibly also consider configuration in Cargo.toml, environment variables like CARGO_PROFILE_RELEASE_* and may accept a --target option, from what I understand the target may have impact on the resolved profile:

cargo print-profile --release

I could try cargo build -vv, but this only prints flags that are explicitly set, it doesn't show default values rustc would use if no value is provided.

Profiles are a Cargo concept and rustc is completely unaware of them; it only sees the individual command line arguments.

I am not sure if this helps at all, but it might clarify what you want to ask for.