rust-lang / rust-lang/rfcs

A unique string key for TypeId

Open
#694 12 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-compiler T-libs
Dominant language
Markdown
Stars
6.6k
Forks
1.7k
Avg merge
16h 14m
Merged PRs (30d)
1

Description

Issue by mzabaluev
Tuesday Jan 13, 2015 at 22:40 GMT

For earlier discussion, see https://github.com/rust-lang/rust/issues/21116

This issue was labelled with: A-libs, A-typesystem in the Rust repository


I want to implement a mapping of Box<T: 'static> to GType. That dynamic type system requires process-unique type names. So I'd like to have a process-unique key, preferably a string, available from TypeId or a similar API.

Now, it's likely that TyDesc names are sufficiently unique, and hash collisions on TypeId break the world as Rust knows it (#17179) so the u64 hash value can be used as practically unique, but: 1) uniqueness constraints on any of those are not documented; 2) access to TyDesc is unsafe.

Contributor guide

No contributing guide indexed for this repository

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 by reading the earlier discussion in rust-lang/rust#21116 and the TypeId and TyDesc concerns described here. The work is complete when the project has an agreed, documented API for a process-unique string key suitable for mapping static Rust types to GType.

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
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.