Skip to content

Should lto = false be treated as LTO "off"? #7491

Open
@ehuss

Description

@ehuss

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 rust-lang/rust#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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ltoArea: link-time optimizationA-profilesArea: profilesS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions