LTO flags are silently ignored if one the crate-type of the root package is not compatible with LTO #14612
Labels
A-diagnostics
Area: Error and warning messages generated by Cargo itself.
A-lto
Area: link-time optimization
C-bug
Category: bug
S-triage
Status: This issue is waiting on initial triage.
Uh oh!
There was an error while loading. Please reload this page.
Problem
Using the
Cargo.toml
below, LTO is not used for thestaticlib
target when building multiple library targets withcargo build --release
.To enable LTO, the
lib
target must be removed, or we must usecargo rustc --crate-type=staticlib
for building separately.Steps
Cargo.toml
:cargo build --release
Possible Solution(s)
Show a warning that LTO is disabled for the LTO-compatible targets, and suggest using
cargo rustc --crate-type=X
.Version
The text was updated successfully, but these errors were encountered: