Skip to content

Tracking issue for RFC 2632, impl const Trait for Ty and ~const (tilde const) syntax #67792

Open

Description

NOTE: See #110395, which tracks a planned rewrite of this feature's implementation

This is the primary tracking issue for rust-lang/rfcs#2632.

The current RFC text can be found at https://internals.rust-lang.org/t/pre-rfc-revamped-const-trait-impl-aka-rfc-2632/15192

This RFC has not yet been accepted. It is being implemented on a provisional basis to evaluate the potential fallout.

cc #57563

The feature gate is const_trait_impl.

Components

  • #[const_trait] attribute
  • impl const Trait
  • T: ~const Trait
  • append_const_msg on rustc_on_unimplemented
  • #[derive_const]
  • trait Destruct

Open issues

When stabilizing: compiler changes are required:

  • Error against putting rustc_const_unstable attribute on const impls as they are now insta-stable.
  • Treat default_method_body_is_const 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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation (MIR interpretation)A-const-fnArea: const fn foo(..) {..}. Pure functions which can be applied at compile time.A-traitsArea: Trait systemC-tracking-issueCategory: A tracking issue for an RFC or an unstable feature.F-const_trait_impl`#![feature(const_trait_impl)]`S-tracking-perma-unstableStatus: The feature will stay unstable indefinitely.T-langRelevant to the language team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions