`CARGO_ENCODED_RUSTFLAGS` doesn't include flags for builtin Cargo options
In particular, it doesn't include LTO flags when using Cargo's [profile.*] lto = "..." option.
This prevents us from correctly passing -flto=..., which affects Rust's bootstrap, and which I hit recently in https://github.com/rust-lang/rust/pull/148925.
I'm unsure if this is something that Cargo is aware of, though see e.g. https://github.com/rust-lang/cargo/issues/12437 for a similar issue. CC @weihanglo, how do you think Cargo would best expose to build scripts like cc-rs that it's doing LTO?
It is more similar to these:
Unfortunately CARGO_ENCODED_RUSTFLAGS doesn't not expose flags controlled by Cargo. It represents extra flags that user passes directly.
Feel free to create a Cargo issue and we can discuss there!