Skip to content

feat(hints): support minimum optimization levels - #17368

Open
0xPoe wants to merge 3 commits into
rust-lang:masterfrom
0xPoe:hint-min-opt-level
Open

feat(hints): support minimum optimization levels#17368
0xPoe wants to merge 3 commits into
rust-lang:masterfrom
0xPoe:hint-min-opt-level

Conversation

@0xPoe

@0xPoe 0xPoe commented Aug 16, 2026

Copy link
Copy Markdown
Member

What does this PR try to resolve?

ref #17334

This PR would allow Rust library to provide a simple hint about the minimum opt-level to build them with via the hint.min-opt-level setting in the manifest.

How to test and review this PR?

Check the unit tests and review it commit by commit.

r?@ghost

Record the current ignored-hint behavior across
the RFC precedence, scope, validation, and boundary cases.

Signed-off-by: 0xPoe <poe.liu@pm.me>
@0xPoe 0xPoe changed the title feat(hints): support minimum optimization levels WIP: feat(hints): support minimum optimization levels Aug 16, 2026
@0xPoe 0xPoe changed the title WIP: feat(hints): support minimum optimization levels WIP(Not Ready For Review): feat(hints): support minimum optimization levels Aug 16, 2026
@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-profiles Area: profiles A-unstable Area: nightly unstable support labels Aug 18, 2026
@0xPoe
0xPoe force-pushed the hint-min-opt-level branch 2 times, most recently from 77b303d to cc5827c Compare August 19, 2026 08:03
RFC 3924 lets a package request a numeric optimization floor without
overriding an application's profile choices. Apply the hint after
profile and built-in host defaults but before explicit package
and build overrides, while leaving the unordered size levels unchanged.

Signed-off-by: 0xPoe <poe.liu@pm.me>
@0xPoe
0xPoe force-pushed the hint-min-opt-level branch 4 times, most recently from 40dc6df to b532a3f Compare August 21, 2026 07:08
Document the unstable gate, accepted range, profile precedence,
non-recursive
scope, and the narrow cases where packages should request optimization.
Include an explicit debugging override so top-level users retain
control.

Signed-off-by: 0xPoe <poe.liu@pm.me>
@0xPoe
0xPoe force-pushed the hint-min-opt-level branch from b532a3f to 2b19c48 Compare August 21, 2026 07:18

@0xPoe 0xPoe left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🔢 Self-check (PR reviewed by myself and ready for feedback)

  • Code compiles successfully

  • Unit tests added

  • No AI-generated elegant nonsense in PR.

  • Comments added where necessary

  • PR title and description updated

  • Documentation updated

  • PR size is reasonable

r?@joshtriplett

View changes since this review

[package]
name = "cargo-util-schemas"
version = "0.14.3"
version = "0.15.0"

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Because we added a new field to a public struct without marking it as non_exhaustive, I bumped the major version.

},
"TomlDebugInfo": {
"type": ["string", "integer", "boolean"],
"type": [

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one was also generated automatically.

Comment thread src/workspace/profiles.rs
&self,
pkg_id: PackageId,
pkg_hints: Option<&Hints>,
hint_min_opt_level: bool,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure if this is the best way to determine whether users want to enable this hint.

@0xPoe 0xPoe changed the title WIP(Not Ready For Review): feat(hints): support minimum optimization levels feat(hints): support minimum optimization levels Aug 21, 2026
@0xPoe
0xPoe marked this pull request as ready for review August 21, 2026 07:20
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-build-execution Area: anything dealing with executing the compiler A-cargo-targets Area: selection and definition of targets (lib, bins, examples, tests, benches) A-documenting-cargo-itself Area: Cargo's documentation A-manifest Area: Cargo.toml issues A-profiles Area: profiles A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants