Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fjarri opened this issue Feb 11, 2025 · 0 comments
Open

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

fjarri opened this issue Feb 11, 2025 · 0 comments

Comments

@fjarri
Copy link

fjarri commented Feb 11, 2025

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant