Skip to content

Add const stability tracking for traits #16

@RalfJung

Description

@RalfJung

I think we should add support for #[rustc_const_(un)stable] attributes on traits. That would set a feature gate which would be required to

  • use this trait in a ~const Trait or const Trait bound
  • write a const impl for that trait
  • call any function from this trait in const context

(All of these also require the const_trait_impl feature gate on top of the per-trait feature gate.)

Currently we have a #[const_trait] attribute; every trait in a staged-api crate that has that attribute should then also be required to have a const stability attribute.

For now, making such a trait rustc_const_stable should be forbidden since the feature is not ready yet. Or maybe we rely on the extra gating with the const_trait_impl feature for that? Once a trait is rustc_const_stable, all its const impl must also be marked rustc_const_stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions