Skip to content

Tracking Issue for RFC 3762, "Make trait methods callable in const contexts" #143874

Open
1 of 6 issues completed

Description

@fee1-dead

This is a tracking issue for the RFC "3762" (rust-lang/rfcs#3762).
The feature gate for the issue is #![feature(const_trait_impl)].

Note

Questions about the usage of this feature should be directed to the t-compiler/project-const-traits Zulip channel. Use t-lang/effects and the RFC (until it gets accepted) to discuss the language feature and future extensions.

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.
Discussion comments will get marked as off-topic or deleted.
Repeated discussions on the tracking issue may lead to the tracking issue getting locked.

Components

Steps

  • Implement the RFC
  • Add const trait Trait and migrate away from #[const_trait] parse const trait Trait #143879
  • Split derive_const, -> impl [const] Trait into separate feature[s] to make initial stabilization minimal
  • add a perf stress test for const trait impls and complex bounds that need solving
  • Adjust documentation (see instructions on rustc-dev-guide)
  • Style updates for any new syntax (nightly-style-procedure)
    • Style team decision on new formatting
    • Formatting for new syntax has been added to the Style Guide
    • (non-blocking) Formatting has been implemented in rustfmt
  • Stabilization PR (see instructions on rustc-dev-guide)
    • Error against putting rustc_const_unstable attribute on const impls as they are now insta-stable.
    • Treat const trait default method bodies and const impl bodies as stable const fn bodies. We need to prevent accidentally stabilizing an implementation that uses unstable lang/lib const fn features.
    • Change Rustdoc to display [const] bounds or what syntax we decided it to be.

Unresolved Questions

Implementation history

Activity

  1. added
    T-langRelevant to the language team
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    WG-const-evalWorking group: Const evaluation
    on Jul 13, 2025
  2. added
    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)
    on Jul 13, 2025
  3. carlocorradini commented on Jul 13, 2025

    @carlocorradini
  4. clarfonthey commented on Jul 13, 2025

    @clarfonthey
    Contributor

    Should this tracking issue also be used for constifying libstd traits or should that get a separate issue? Since that was the trend before the current RFC, but there's been a lot of lapsing since, and it probably would require opening a lot of new issues to fix it.

    I think that at least some traits that are kind of fundamental and require extra compiler support (like Fn*) should be tracked here but mostly just want to clarify.

    Edit: also to clarify, since I'm particularly interested in constifying a bunch of traits to make SIMD operations const-usable, I'd be more than happy to spearhead the effort to separate out the const traits into their own tracking issues. Just want to make sure this is the desired approach before I do anything.

  5. fee1-dead commented on Jul 13, 2025

    @fee1-dead
    MemberAuthor

    Should this tracking issue also be used for constifying libstd traits or should that get a separate issue?

    I think we're okay with separate tracking issues but please make sure that those tracking issues link back to this one. As when we do stabilize const traits most of those have to be stabilized in tandem (since you can't really keep const impls unstable).

  6. clarfonthey commented on Jul 13, 2025

    @clarfonthey
    Contributor

    (since you can't really keep const impls unstable).

    Wouldn't #140399 help with that, presuming that this PR + some form of it that works for const-stability also apply before const traits are stable?

    (I agree with you on linking back here, though.)

  7. compiler-errors commented on Jul 13, 2025

    @compiler-errors
    Contributor

    As when we do stabilize const traits most of those have to be stabilized in tandem (since you can't really keep const impls unstable).

    I'm not really sure if I understand the point made here about stabilizing things at the same time of stabilizing const traits in general.

    Isn't that the the whole point of the feature checking in #135423 + #136055?

    We definitely should be able to constify traits piecewise without them being insta-stable when we stabilize the const_trait_impl feature gate. Of course impls can't be constified individually, but traits should be at least.

  8. fee1-dead commented on Jul 13, 2025

    @fee1-dead
    MemberAuthor

    sorry, I misspoke in my earlier comment. because we have const stability enforced on traits now we can of course keep traits const_unstable in libstd when we stabilize const_trait_impl, so yeah they should all be split

  9. 43 remaining items

  10. added a commit that references this issue on Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-trait-systemArea: Trait systemB-experimentalBlocker: In-tree experiment; RFC pending, not yet approved or unneeded (requires FCP to stabilize).B-unstableBlocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCF-const_trait_impl`#![feature(const_trait_impl)]`PG-const-traitsProject group: Const traitsS-tracking-needs-design-proposalStatus: This needs a clear design proposal and then a meeting with the team.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamT-typesRelevant to the types team, which will review and decide on the PR/issue.WG-const-evalWorking group: Const evaluation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions