Skip to content

Conversation

smoelius
Copy link
Contributor

Aside from false, the lto options seem to be ordered from "most optimizing" to "least optimizing".

If this interpretation is correct, then I think false should go between thin and off.

cc: @ehuss (who I think wrote that text)

@rustbot
Copy link
Collaborator

rustbot commented Aug 15, 2025

r? @epage

rustbot has assigned @epage.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-documenting-cargo-itself Area: Cargo's documentation S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 15, 2025
Copy link
Member

@weihanglo weihanglo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@@ -166,16 +166,16 @@ The `lto` setting controls `rustc`'s [`-C lto`], [`-C linker-plugin-lto`], and
LTO can produce better optimized code, using whole-program analysis, at the cost
of longer linking time.

The valid options are:
The valid options from most to least optimizing are:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, this is not true in the general case. fat LTO can produce faster executables than ThinLTO and even if it doesn't, it is often very close. ThinLTO just generally produces a bit bigger executables.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in terms of executable performance,

is it fat >= ThinLTO or ThinLTO >= fat, or hard to say?

Copy link
Member

@bjorn3 bjorn3 Aug 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I understand it, it could be either way nowadays. There is probably still some bias for fat LTO producing faster executables than ThinLTO though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for pointing it out!

There is another similar ongoing in rust-lang/rust rust-lang/rust#145533. Do you think we should r- that, and revert this PR as well?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the order makes sense. I just think we should not explicitly say "from most to least optimizing" here.

bors added a commit to rust-lang/rust that referenced this pull request Aug 17, 2025
Update cargo

28 commits in 840b83a10fb0e039a83f4d70ad032892c287570a..71eb84f21aef43c07580c6aed6f806a6299f5042
2025-07-30 13:59:19 +0000 to 2025-08-17 17:18:56 +0000
- update tests to match lint message changes from #140794 (rust-lang/cargo#15849)
- chore: downgrade to [email protected] (rust-lang/cargo#15851)
- Reorder `lto` options in profiles.md (rust-lang/cargo#15841)
- feat(unstable): add -Zbuild-analysis unstable feature (rust-lang/cargo#15845)
- refactor(unstable): group stabilized features (rust-lang/cargo#15846)
- Fixes error while running the cargo clippy --all-targets -- -D warning (rust-lang/cargo#15843)
- Clarify that `cargo doc --no-deps` is cumulative and won’t delete prev (rust-lang/cargo#15800)
- docs: Formatting and cross-linking to build-dir/target-dir docs (rust-lang/cargo#15840)
- Stabilize `build.build-dir` (rust-lang/cargo#15833)
- make resolve features public for cargo-as-a-library (rust-lang/cargo#15835)
- chore(deps): bump slab from 0.4.10 to 0.4.11 (rust-lang/cargo#15832)
- chore: remove x86_64-apple-darwin from CI and tests (rust-lang/cargo#15831)
- chore(deps): update msrv (3 versions) to v1.87 (rust-lang/cargo#15819)
- perf(package): Always reuse the workspace's target-dir (rust-lang/cargo#15783)
- More helpful error for invalid cargo-features = [] (rust-lang/cargo#15781)
- Add initial integration for `--json=timings` behing `-Zsection-timings` (rust-lang/cargo#15780)
- add is_inherited methods to InheritableDependency and InheritableField (rust-lang/cargo#15828)
- chore(deps): update compatible (rust-lang/cargo#15804)
- docs(unstable): Link out to the Plumbing commands effort (rust-lang/cargo#15821)
- chore(deps): update cargo-semver-checks to v0.43.0 (rust-lang/cargo#15825)
- test(build-std): relax the thread name assertion (rust-lang/cargo#15822)
- chore(deps): update msrv (1 version) to v1.89 (rust-lang/cargo#15815)
- Update semver tests for 1.89 (rust-lang/cargo#15816)
- Accessing each build script's `OUT_DIR` and in the correct order (rust-lang/cargo#15776)
- chore: bump to 0.92.0; update changelog (rust-lang/cargo#15807)
- docs: `-Zpackage-workspace` has been stabilized (rust-lang/cargo#15808)
- chore(deps): update rust crate cargo_metadata to 0.21.0 (rust-lang/cargo#15795)
- docs(build-rs): Fix broken intra-doc links (rust-lang/cargo#15810)
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 17, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
weihanglo added a commit to weihanglo/cargo that referenced this pull request Aug 18, 2025
There is no clear winner between fat LTO and ThinLTO,
so don't say "from most to least optimizing" here.

See rust-lang#15841 (comment)
bors added a commit to rust-lang/rust that referenced this pull request Aug 18, 2025
Update cargo

28 commits in 840b83a10fb0e039a83f4d70ad032892c287570a..71eb84f21aef43c07580c6aed6f806a6299f5042
2025-07-30 13:59:19 +0000 to 2025-08-17 17:18:56 +0000
- update tests to match lint message changes from #140794 (rust-lang/cargo#15849)
- chore: downgrade to [email protected] (rust-lang/cargo#15851)
- Reorder `lto` options in profiles.md (rust-lang/cargo#15841)
- feat(unstable): add -Zbuild-analysis unstable feature (rust-lang/cargo#15845)
- refactor(unstable): group stabilized features (rust-lang/cargo#15846)
- Fixes error while running the cargo clippy --all-targets -- -D warning (rust-lang/cargo#15843)
- Clarify that `cargo doc --no-deps` is cumulative and won’t delete prev (rust-lang/cargo#15800)
- docs: Formatting and cross-linking to build-dir/target-dir docs (rust-lang/cargo#15840)
- Stabilize `build.build-dir` (rust-lang/cargo#15833)
- make resolve features public for cargo-as-a-library (rust-lang/cargo#15835)
- chore(deps): bump slab from 0.4.10 to 0.4.11 (rust-lang/cargo#15832)
- chore: remove x86_64-apple-darwin from CI and tests (rust-lang/cargo#15831)
- chore(deps): update msrv (3 versions) to v1.87 (rust-lang/cargo#15819)
- perf(package): Always reuse the workspace's target-dir (rust-lang/cargo#15783)
- More helpful error for invalid cargo-features = [] (rust-lang/cargo#15781)
- Add initial integration for `--json=timings` behing `-Zsection-timings` (rust-lang/cargo#15780)
- add is_inherited methods to InheritableDependency and InheritableField (rust-lang/cargo#15828)
- chore(deps): update compatible (rust-lang/cargo#15804)
- docs(unstable): Link out to the Plumbing commands effort (rust-lang/cargo#15821)
- chore(deps): update cargo-semver-checks to v0.43.0 (rust-lang/cargo#15825)
- test(build-std): relax the thread name assertion (rust-lang/cargo#15822)
- chore(deps): update msrv (1 version) to v1.89 (rust-lang/cargo#15815)
- Update semver tests for 1.89 (rust-lang/cargo#15816)
- Accessing each build script's `OUT_DIR` and in the correct order (rust-lang/cargo#15776)
- chore: bump to 0.92.0; update changelog (rust-lang/cargo#15807)
- docs: `-Zpackage-workspace` has been stabilized (rust-lang/cargo#15808)
- chore(deps): update rust crate cargo_metadata to 0.21.0 (rust-lang/cargo#15795)
- docs(build-rs): Fix broken intra-doc links (rust-lang/cargo#15810)
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 18, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

``@weihanglo`` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
Zalathar added a commit to Zalathar/rust that referenced this pull request Aug 18, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

```@weihanglo``` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
bors added a commit to rust-lang/rust that referenced this pull request Aug 18, 2025
Update cargo

28 commits in 840b83a10fb0e039a83f4d70ad032892c287570a..71eb84f21aef43c07580c6aed6f806a6299f5042
2025-07-30 13:59:19 +0000 to 2025-08-17 17:18:56 +0000
- update tests to match lint message changes from #140794 (rust-lang/cargo#15849)
- chore: downgrade to [email protected] (rust-lang/cargo#15851)
- Reorder `lto` options in profiles.md (rust-lang/cargo#15841)
- feat(unstable): add -Zbuild-analysis unstable feature (rust-lang/cargo#15845)
- refactor(unstable): group stabilized features (rust-lang/cargo#15846)
- Fixes error while running the cargo clippy --all-targets -- -D warning (rust-lang/cargo#15843)
- Clarify that `cargo doc --no-deps` is cumulative and won’t delete prev (rust-lang/cargo#15800)
- docs: Formatting and cross-linking to build-dir/target-dir docs (rust-lang/cargo#15840)
- Stabilize `build.build-dir` (rust-lang/cargo#15833)
- make resolve features public for cargo-as-a-library (rust-lang/cargo#15835)
- chore(deps): bump slab from 0.4.10 to 0.4.11 (rust-lang/cargo#15832)
- chore: remove x86_64-apple-darwin from CI and tests (rust-lang/cargo#15831)
- chore(deps): update msrv (3 versions) to v1.87 (rust-lang/cargo#15819)
- perf(package): Always reuse the workspace's target-dir (rust-lang/cargo#15783)
- More helpful error for invalid cargo-features = [] (rust-lang/cargo#15781)
- Add initial integration for `--json=timings` behing `-Zsection-timings` (rust-lang/cargo#15780)
- add is_inherited methods to InheritableDependency and InheritableField (rust-lang/cargo#15828)
- chore(deps): update compatible (rust-lang/cargo#15804)
- docs(unstable): Link out to the Plumbing commands effort (rust-lang/cargo#15821)
- chore(deps): update cargo-semver-checks to v0.43.0 (rust-lang/cargo#15825)
- test(build-std): relax the thread name assertion (rust-lang/cargo#15822)
- chore(deps): update msrv (1 version) to v1.89 (rust-lang/cargo#15815)
- Update semver tests for 1.89 (rust-lang/cargo#15816)
- Accessing each build script's `OUT_DIR` and in the correct order (rust-lang/cargo#15776)
- chore: bump to 0.92.0; update changelog (rust-lang/cargo#15807)
- docs: `-Zpackage-workspace` has been stabilized (rust-lang/cargo#15808)
- chore(deps): update rust crate cargo_metadata to 0.21.0 (rust-lang/cargo#15795)
- docs(build-rs): Fix broken intra-doc links (rust-lang/cargo#15810)
github-merge-queue bot pushed a commit that referenced this pull request Aug 18, 2025
…15855)

There is no clear winner between fat LTO and ThinLTO, so don't say "from
most to least optimizing" here.

See #15841 (comment)
@rustbot rustbot added this to the 1.91.0 milestone Aug 18, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 18, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
jhpratt added a commit to jhpratt/rust that referenced this pull request Aug 18, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

``@weihanglo`` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
@smoelius smoelius deleted the patch-1 branch August 19, 2025 00:32
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Aug 19, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
rust-timer added a commit to rust-lang/rust that referenced this pull request Aug 19, 2025
Rollup merge of #145533 - smoelius:patch-2, r=lqd

Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 20, 2025
Update cargo

28 commits in 840b83a10fb0e039a83f4d70ad032892c287570a..71eb84f21aef43c07580c6aed6f806a6299f5042
2025-07-30 13:59:19 +0000 to 2025-08-17 17:18:56 +0000
- update tests to match lint message changes from rust-lang/rust#140794 (rust-lang/cargo#15849)
- chore: downgrade to [email protected] (rust-lang/cargo#15851)
- Reorder `lto` options in profiles.md (rust-lang/cargo#15841)
- feat(unstable): add -Zbuild-analysis unstable feature (rust-lang/cargo#15845)
- refactor(unstable): group stabilized features (rust-lang/cargo#15846)
- Fixes error while running the cargo clippy --all-targets -- -D warning (rust-lang/cargo#15843)
- Clarify that `cargo doc --no-deps` is cumulative and won’t delete prev (rust-lang/cargo#15800)
- docs: Formatting and cross-linking to build-dir/target-dir docs (rust-lang/cargo#15840)
- Stabilize `build.build-dir` (rust-lang/cargo#15833)
- make resolve features public for cargo-as-a-library (rust-lang/cargo#15835)
- chore(deps): bump slab from 0.4.10 to 0.4.11 (rust-lang/cargo#15832)
- chore: remove x86_64-apple-darwin from CI and tests (rust-lang/cargo#15831)
- chore(deps): update msrv (3 versions) to v1.87 (rust-lang/cargo#15819)
- perf(package): Always reuse the workspace's target-dir (rust-lang/cargo#15783)
- More helpful error for invalid cargo-features = [] (rust-lang/cargo#15781)
- Add initial integration for `--json=timings` behing `-Zsection-timings` (rust-lang/cargo#15780)
- add is_inherited methods to InheritableDependency and InheritableField (rust-lang/cargo#15828)
- chore(deps): update compatible (rust-lang/cargo#15804)
- docs(unstable): Link out to the Plumbing commands effort (rust-lang/cargo#15821)
- chore(deps): update cargo-semver-checks to v0.43.0 (rust-lang/cargo#15825)
- test(build-std): relax the thread name assertion (rust-lang/cargo#15822)
- chore(deps): update msrv (1 version) to v1.89 (rust-lang/cargo#15815)
- Update semver tests for 1.89 (rust-lang/cargo#15816)
- Accessing each build script's `OUT_DIR` and in the correct order (rust-lang/cargo#15776)
- chore: bump to 0.92.0; update changelog (rust-lang/cargo#15807)
- docs: `-Zpackage-workspace` has been stabilized (rust-lang/cargo#15808)
- chore(deps): update rust crate cargo_metadata to 0.21.0 (rust-lang/cargo#15795)
- docs(build-rs): Fix broken intra-doc links (rust-lang/cargo#15810)
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Aug 20, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Aug 25, 2025
Reorder `lto` options from most to least optimizing

This is a follow up to rust-lang/cargo#15841.

`@weihanglo` pointed out the original order of the `lto` options in the Cargo book was consistent with https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=lto#lto.

The options in the Cargo book have since been reordered. This PR keeps the two references consistent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants