Skip to content

Combination of lto=true and crate-type = ["cdylib", "rlib"] confusingly doesn't do lto #9672

Open
@matklad

Description

@matklad

See https://github.com/matklad/repros/tree/6b5121590ed9a758b90bb269d2d3d860a381a21d/lto-vs-rlib for the full reproduction.

The TL;DR is that if I have lto=true in profile, and crate-type = ["cdylib", "rlib"], the lto silently isn't applied. This is confusing -- I would expect to see at least a warning.

Note that wasm+cdylib+rlib combination is advertised in https://rustwasm.github.io/wasm-pack/book/tutorials/npm-browser-packages/template-deep-dive/cargo-toml.html#1-crate-type, and you often do want lto for wasm.

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ltoArea: link-time optimizationC-bugCategory: bugS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions