Skip to content

Tracking Issue for hint-min-opt-level #17334

Open

Description

@weihanglo

Summary

RFC: #3924
Implementation:
Documentation:

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.

Unresolved Issues

  • Should a profile with opt-level = "s" or opt-level = "z" override a dependency's min-opt-level? This RFC says it should, but sometimes users might not want that. We could also give more control over that.

Future Extensions

  • There are many other possible optimization hints a library might wish to provide, and we could consider adding further hints for those in the future.
  • Have a max-opt-level, for crates that don't benefit from opt-level = 3 to lower the optimiation level to 2.
  • The mechanism to override a dependency's opt-level using profile.dev.package forces a given opt-level whether the dependency asks for higher or lower. Users of overrides, particularly those for "*", might want a mechanism for setting a minimum without overriding a higher optimization level.
  • Change the default optimization level for the dev profile to 1, rather than 0. opt-level 1 includes optimizations that can make compilation faster, such as by sending less code to the codegen backend (e.g.
    LLVM).
  • Provide a further mechanism for libraries whose performance depends heavily on their dependencies to optimize those dependencies.
  • Provide a mechanism for libraries to optimize code inlined or monomorphized by a user's crate. That would likely require compiler enhancements.
  • Surface this in a visible way for users to see that it has been applied to their dependencies. For instance, we could note it in --timings.

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Activity

  1. 0xPoe commented on Aug 9, 2026

    @0xPoe
    Member

    I have discussed this with @joshtriplett, and I will go ahead and implement it. He will help review it.

  2. self-assigned this
    on Aug 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-tracking-issueCategory: A tracking issue for something unstable.

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions