Should `lto = false` be treated as LTO "off"?
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Currently, a Cargo profile of lto = false is actually "thin local" LTO where LTO is performed across the local crate's codegen units. I'm wondering if that should actually be treated as -C lto=off where LTO is completely disabled?
This would change the behavior for manifests that set lto = false, which shows up occasionally since people copy/paste all the defaults.
Unfortunately there would be no way to explicitly express the default if this was changed, which I think would be a problem (or annoyance). We could add an explicit string ('thin-local'), and translate that to no -C lto flag, or add that to rustc itself.
Another option is to keep the current behavior, and just document that the default of false actually still performs some form of LTO, and that the string "off" should be used to completely turn it off. cc https://github.com/rust-lang/rust/pull/65136 where I am proposing to document these flags on the rustc side.
I kinda lean towards the documentation side, since otherwise it would change behavior for some projects, and probably isn't too important to be absolutely correct here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing Cargo's profile handling alongside the linked rustc PR about documenting LTO flags. Resolve whether lto = false should retain its current behavior, map to -C lto=off, or gain an explicit thin-local form; document or test the chosen semantics before considering the issue done.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100