-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Problem
The docs for build scripts say that OPT_LEVEL and DEBUG are set to the "values of the corresponding variables for the profile currently being built". However, this is only true for OPT_LEVEL; DEBUG is always "true" or "false":
cargo/src/cargo/core/compiler/custom_build.rs
Lines 365 to 366 in 40086e8
| .env("DEBUG", debug.to_string()) | |
| .env("OPT_LEVEL", &unit.profile.opt_level) |
This prevents tools like cc-rs from making more fine-grained decisions about what debug info to include, which I implemented in rust-lang/cc-rs#1624 before realizing Cargo didn't actually support it.
Steps
No response
Possible Solution(s)
I would love to just change this, but of course there may be build scripts depending on the existing behavior. :-( If it is not to be changed, the docs should be adjusted to match the actual behavior.
Notes
The docs probably were correct way back in Rust/Cargo's history, when this was just a boolean option.
Version
(discovered in Cargo 1.89, but verified with code investigation in main)