Skip to content

Tracking Issue for comparing TypeId in const items #101871

Open
@raldone01

Description

@raldone01

Feature gate: #![feature(const_cmp_type_id)]

This is a tracking issue for comparing TypeId in const items.

Public API

impl const PartialEq for TypeId {}
impl const PartialOrd for TypeId {}
impl const Ord for TypeId {}

Steps / History

Unresolved Questions

  • Making these const precludes some possible implementations, such as the one where TypeId includes a pointer to a static as proposed in TypeId: use a (v0) mangled type to remain sound in the face of hash collisions. #95845. This const-ness should not be stabilized without an explicit decision that we never want such an implementation.

    raldone01: I don't think adding a 'static pointer would be a problem as the contents of the pointer would be compared and not the pointer addresses.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-langRelevant to the language team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API 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