rust-lang / rust-lang/rust

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

Open
#143,874 9 comments 136 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-const-eval A-trait-system B-experimental B-unstable C-tracking-issue F-const_trait_impl PG-const-traits S-tracking-needs-design-proposal T-compiler T-lang T-types WG-const-eval
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

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] #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
  • #[derive_const] for custom derives (proc macros) #118304
Implementation history

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with RFC 3762, the const_trait_impl feature gate, and the unchecked components in the tracking checklist. Review the implementation history and linked closed pull requests before choosing a separately scoped task. Done means completing one defined checklist item, including any required documentation or style updates, and recording the progress here.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.