Feature request: expose the Link Time Optimization profile settings to build scripts #15144
Labels
A-build-scripts
Area: build.rs scripts
A-profiles
Area: profiles
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
S-needs-team-input
Status: Needs input from team on whether/how to proceed.
Problem
It is not possible for build scripts to see whether the profile that is currently used enables LTO, or which level of it.
Proposed Solution
Make the value of the
lto
profile setting exposed to build scripts as an environment variable, along with the other ones: https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-build-scripts.Notes
My reason for wanting this is that I use the
no-panic
crate to verify that a project of mine can't panic. In order to give some feedback if this test results in false positives I would like to be able to detect in a build script if the current profile enabled fat LTO.EDIT: This is because
no-panic
can give false positives if LTO and optimizations are not enabled.A related issue was recently closed: #11054.
Thanks for your time!
The text was updated successfully, but these errors were encountered: