Tracking Issue for const fn
type_id
· Issue #77125 · rust-lang/rust (original) (raw)
This is a tracking issue for using TypeId::of
in constant contexts.
The feature gate for the issue is #![feature(const_type_id)]
.
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.
Steps
- Come up with a new scheme for collision resistant type ids
- Figure out any safeguards we need to prevent messing with the bits of type id directly
- Adjust documentation (see instructions on rustc-dev-guide)
- Stabilization PR (see instructions on rustc-dev-guide)
Unresolved Questions
- How can we prevent abuses of transmuting type ids into integers at compile time (where we have fewer tools to deal with them)? See the discussion in Widen TypeId from 64 bits to 128. #75923
- We need a new scheme for building type ids that's collision resistant. We'd like to do this before stabilizing type ids in constant contexts. Collisions in type_id #10389, type_id is not sufficiently collision-resistant #129014
Implementation history
- Initial const implementation Turn type_id into a constant intrinsic #47892
- Initial stabilization Stabilize const_type_id feature #72488
- Reverted stabilization revert const_type_id stabilization #77083