Skip to content

Is it safe to use any::type_name() for serialization? #286

@fjarri

Description

@fjarri

I noticed that Serialize implementation of BitVec (and probably other types as well) uses any::type_name<Order>() to serialize the order. The docs for it say:

The returned string must not be considered to be a unique identifier of a type as multiple types may map to the same type name. Similarly, there is no guarantee that all parts of a type will appear in the returned string: for example, lifetime specifiers are currently not included. In addition, the output may change between versions of the compiler.

So, basically, a compiler update, or even some internal rearrangement in the library, can break the ABI. Could the order be serialized in a more stable way somehow?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions